summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO3
-rw-r--r--PKGBUILD4
-rw-r--r--nix.install116
3 files changed, 38 insertions, 85 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8a00b07e58bf..e5a5b3444cab 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = nix
pkgdesc = A purely functional package manager
pkgver = 2.2.2
- pkgrel = 2
+ pkgrel = 3
url = https://nixos.org/nix
install = nix.install
arch = i686
@@ -15,6 +15,7 @@ pkgbase = nix
depends = boost
depends = brotli
depends = editline
+ depends = archlinux-nix
source = https://nixos.org/releases/nix/nix-2.2.2/nix-2.2.2.tar.xz
sha256sums = f80a1b4f9837a8d33209f0b7769d5038335459ff4303eccf3e9217a9eca8594c
diff --git a/PKGBUILD b/PKGBUILD
index 7b68c7a839eb..3160164a708f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,12 +8,12 @@
pkgname=nix
pkgver=2.2.2
-pkgrel=2
+pkgrel=3
pkgdesc="A purely functional package manager"
arch=('i686' 'x86_64' 'armv7h')
url="https://nixos.org/nix"
license=('LGPL')
-depends=('gc' 'libsodium' 'boost' 'brotli' 'editline')
+depends=('gc' 'libsodium' 'boost' 'brotli' 'editline' 'archlinux-nix')
makedepends=('bzip2' 'openssl')
install=nix.install
source=("https://nixos.org/releases/nix/nix-$pkgver/nix-$pkgver.tar.xz")
diff --git a/nix.install b/nix.install
index 613cee6d0413..551b35f1f7c9 100644
--- a/nix.install
+++ b/nix.install
@@ -1,97 +1,49 @@
-
-pre_install () {
- # Check that the group and users don't already exist
- if [[ -n $(cut -d: -f1 /etc/group | grep -w nixbld) ]]; then
- echo "The nixbld group already exists. This install cannot proceed."
- exit 1
- fi
-
- for i in {1..10}; do
- if [[ -n $(cut -d: -f1 /etc/passwd | grep -w nixbld$i) ]]; then
- echo "The nixbld$i user already exists. This install cannot proceed."
- exit 1
- fi
- done
-}
-
-create_users () {
- # Create a nixbld group.
- groupadd -r nixbld
-
- # Create 10 nixbld{i} users
- for i in {1..10}; do
- useradd -g nixbld -G nixbld -r -N -M -d /var/empty -s /sbin/nologin nixbld$i
- done
-}
-
-delete_users() {
- # Remove the users
- for i in {1..10}; do
- userdel nixbld$i
- done
-
- # Remove the group
- groupdel nixbld
-}
-
-create_store() {
- # Create nix folders and set permissions
- mkdir -p /nix/store
- chown root.nixbld /nix/store
- chmod 1775 /nix/store
- mkdir -p -m 1777 /nix/var/nix/gcroots/per-user
- mkdir -p -m 1777 /nix/var/nix/profiles/per-user
-}
-
-restore_store() {
- # Restore folder permissions
- chmod 755 /nix/store
- chown root.root /nix/store
-}
-
-init_channels() {
- # Initialize default nix channel
- echo "Initializing default nix channel"
- source /etc/profile.d/nix.sh
- nix-channel --update
+install_info() {
+ echo "Nix is installed and configured, and the nix-daemon should be running. To check,"
+ echo "you can run:"
+ echo
+ echo " archlinux-nix status"
+ echo
+ echo "Each user's environment is setup on login. Alternatively, you can execute the"
+ echo "following to avoid having to log back in:"
+ echo
+ echo " source /etc/profile.d/nix{,-daemon}.sh"
+ echo
+ echo "For more information on how to use nix, check out Part III of the Nix Manual:"
+ echo
+ echo " https://nixos.org/nix/manual/#chap-package-management"
+ echo
}
-daemon_info() {
- echo "To start the nix daemon, execute one of the following:"
+remove_info() {
+ echo "You may wish to do some clean up:"
+ echo
+ echo "1. delete /nix folder"
+ echo " # rm -r /nix"
echo
- echo " systemctl enable nix-daemon.socket # Sets the daemon to start on next boot"
- echo " systemctl enable --now nix-daemon.socket # Starts now and on next boot too"
+ echo "2. delete the build users (if any)"
+ echo " # archlinux-nix delete-build-group"
echo
- echo "Also, if this is a new install, you need to start a new login shell or otherwise"
+ echo "3. delete the config dir"
+ echo " # rm -r /etc/nix"
echo
- echo " source /etc/profile.d/nix.sh"
- echo " source /etc/profile.d/nix-daemon.sh"
+ echo "4. uninstall the archlinux-nix tool"
+ echo " pacman -R archlinux-nix"
+ echo
+ echo "5. you may also want to delete nix-related files from users' home dirs"
+ echo " # rm -r /root/.nix-* /home/*/.nix-*"
echo
- echo "Once your environment is set-up, you will need to add some channels. You can see how"
- echo "to do that here:"
- echo " https://nixos.org/nix/manual/#sec-channels"
}
post_install() {
- create_users
- create_store
- init_channels
- daemon_info
-}
-
-pre_upgrade() {
- systemctl stop nix-daemon.socket
- systemctl stop nix-daemon
+ archlinux-nix bootstrap
+ install_info
}
post_upgrade() {
- delete_users
- create_users
- create_store
- daemon_info
+ archlinux-nix bootstrap
}
-pre_remove() {
- restore_store
- delete_users
+post_remove() {
+ remove_info
}