3 # Check that the group and users don't already exist
4 if [[ -n $(cut -d: -f1 /etc/group | grep -w nixbld) ]]; then
5 echo "The nixbld group already exists. This install cannot proceed."
10 if [[ -n $(cut -d: -f1 /etc/passwd | grep -w nixbld$i) ]]; then
11 echo "The nixbld$i user already exists. This install cannot proceed."
18 # Create a nixbld group.
21 # Create 10 nixbld{i} users
23 useradd -g nixbld -G nixbld -r -N -M -d /var/empty -s /sbin/nologin nixbld$i
38 # Create nix folders and set permissions
40 chown root.nixbld /nix/store
42 mkdir -p -m 1777 /nix/var/nix/gcroots/per-user
43 mkdir -p -m 1777 /nix/var/nix/profiles/per-user
47 # Restore folder permissions
49 chown root.root /nix/store
53 # Initialize default nix channel
54 echo "Initializing default nix channel"
55 source /etc/profile.d/nix.sh
60 echo "To start the nix daemon, execute one of the following:"
62 echo " systemctl enable nix-daemon.socket # Sets the daemon to start on next boot"
63 echo " systemctl enable --now nix-daemon.socket # Starts now and on next boot too"
65 echo "Also, if this is a new install, you need to start a new login shell or otherwise"
67 echo " source /etc/profile.d/nix.sh"
68 echo " source /etc/profile.d/nix-daemon.sh"
70 echo "Once your environment is set-up, you will need to add some channels. You can see how"
71 echo "to do that here:"
72 echo " https://nixos.org/nix/manual/#sec-channels"
83 systemctl stop nix-daemon.socket
84 systemctl stop nix-daemon