Skip to content

Instantly share code, notes, and snippets.

@samuela
Created December 6, 2022 20:18
Show Gist options
  • Save samuela/71a24d17204a690fad6398170c74dc03 to your computer and use it in GitHub Desktop.
Save samuela/71a24d17204a690fad6398170c74dc03 to your computer and use it in GitHub Desktop.
sam.ainsworth@cs-tze7x4cv-gpu-homedir-350808:~$ sudo rm /etc/bashrc.backup-before-nix /etc/zshrc.backup-before-nix /etc/profile.d/nix.sh.backup-before-nix /etc/bash.bashrc.backup-before-nix /etc/zsh/zshrc.backup-before-nix
rm: cannot remove '/etc/bashrc.backup-before-nix': No such file or directory
rm: cannot remove '/etc/zshrc.backup-before-nix': No such file or directory
rm: cannot remove '/etc/profile.d/nix.sh.backup-before-nix': No such file or directory
rm: cannot remove '/etc/bash.bashrc.backup-before-nix': No such file or directory
sam.ainsworth@cs-tze7x4cv-gpu-homedir-350808:~$ { echo "60a518fa8b820b87fb6dbba01532aab0 /tmp/install-nix.sh" | md5sum --check -; } && { yes | sh /tmp/install-nix.sh --daemon; }
/tmp/install-nix.sh: OK
downloading Nix 2.12.0 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.12.0/nix-2.12.0-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.2R8fuFmqso'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 19.5M 100 19.5M 0 0 99.5M 0 --:--:-- --:--:-- --:--:-- 99.5M
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation
This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:
1. Make sure your computer doesn't already have Nix. If it does, I
will show you instructions on how to clean up your old install.
2. Show you what I am going to install and where. Then I will ask
if you are ready to continue.
3. Create the system users and groups that the Nix daemon uses to run
builds.
4. Perform the basic installation of the Nix files daemon.
5. Configure your shell to import special Nix Profile files, so you
can use Nix.
6. Start the Nix daemon.
Would you like to see a more detailed list of what I will do?
No TTY, assuming you would say yes :)
I will:
- make sure your computer doesn't already have Nix files
(if it does, I will tell you how to clean them up.)
- create local users (see the list above for the users I'll make)
- create a local group (nixbld)
- install Nix in to /nix
- create a configuration file in /etc/nix
- set up the "default profile" by creating some Nix-related files in
/root
- back up /etc/bashrc to /etc/bashrc.backup-before-nix
- update /etc/bashrc to include some Nix configuration
- back up /etc/profile.d/nix.sh to /etc/profile.d/nix.sh.backup-before-nix
- update /etc/profile.d/nix.sh to include some Nix configuration
- back up /etc/zshrc to /etc/zshrc.backup-before-nix
- update /etc/zshrc to include some Nix configuration
- back up /etc/bash.bashrc to /etc/bash.bashrc.backup-before-nix
- update /etc/bash.bashrc to include some Nix configuration
- back up /etc/zsh/zshrc to /etc/zsh/zshrc.backup-before-nix
- update /etc/zsh/zshrc to include some Nix configuration
- load and start a service (at /etc/systemd/system/nix-daemon.service
and /etc/systemd/system/nix-daemon.socket) for nix-daemon
Ready to continue?
No TTY, assuming you would say yes :)
---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Normally, it would show you
exactly what commands it is running and why. However, the script is
run in a headless fashion, like this:
$ curl -L https://nixos.org/nix/install | sh
or maybe in a CI pipeline. Because of that, I'm going to skip the
verbose output in the interest of brevity.
If you would like to
see the output, try like this:
$ curl -L -o install-nix https://nixos.org/nix/install
$ sh ./install-nix
~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.
---- Nix config report ---------------------------------------------------------
Temp Dir: /tmp/tmp.zrIpaeKQQD
Nix Root: /nix
Build Users: 32
Build Group ID: 30000
Build Group Name: nixbld
build users:
Username: UID
nixbld1: 30001
nixbld2: 30002
nixbld3: 30003
nixbld4: 30004
nixbld5: 30005
nixbld6: 30006
nixbld7: 30007
nixbld8: 30008
nixbld9: 30009
nixbld10: 30010
nixbld11: 30011
nixbld12: 30012
nixbld13: 30013
nixbld14: 30014
nixbld15: 30015
nixbld16: 30016
nixbld17: 30017
nixbld18: 30018
nixbld19: 30019
nixbld20: 30020
nixbld21: 30021
nixbld22: 30022
nixbld23: 30023
nixbld24: 30024
nixbld25: 30025
nixbld26: 30026
nixbld27: 30027
nixbld28: 30028
nixbld29: 30029
nixbld30: 30030
nixbld31: 30031
nixbld32: 30032
Ready to continue?
No TTY, assuming you would say yes :)
~~> Setting up the build group nixbld
Exists: Yes
~~> Setting up the build user nixbld1
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 1
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld2
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 2
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld3
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 3
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld4
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 4
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld5
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 5
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld6
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 6
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld7
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 7
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld8
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 8
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld9
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 9
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld10
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 10
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld11
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 11
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld12
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 12
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld13
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 13
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld14
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 14
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld15
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 15
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld16
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 16
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld17
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 17
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld18
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 18
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld19
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 19
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld20
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 20
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld21
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 21
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld22
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 22
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld23
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 23
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld24
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 24
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld25
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 25
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld26
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 26
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld27
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 27
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld28
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 28
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld29
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 29
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld30
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 30
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld31
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 31
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the build user nixbld32
Exists: Yes
Hidden: Yes
Home Directory: /var/empty
usermod: no changes
Note: Nix build user 32
Logins Disabled: Yes
Member of nixbld: Yes
PrimaryGroupID: 30000
~~> Setting up the basic directory structure
~~> Installing Nix
Alright! We have our first nix at /nix/store/h88w1442c7hzkbw8sgpcsbqp4lhz6l5p-nix-2.12.0
Just finished getting the nix database ready.
~~> Setting up shell profiles: /etc/bashrc /etc/profile.d/nix.sh /etc/zshrc /etc/bash.bashrc /etc/zsh/zshrc
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
~~> Setting up shell profiles for Fish with with conf.d/nix.fish inside /etc/fish /usr/local/etc/fish /opt/homebrew/etc/fish /opt/local/etc/fish
~~> Setting up the default profile
replacing old 'nix-2.12.0'
installing 'nix-2.12.0'
unpacking channels...
~~> Setting up the nix-daemon systemd service
Failed to link unit: Too many levels of symbolic links
---- oh no! --------------------------------------------------------------------
Oh no, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.
:(
We'd love to help if you need it.
You can open an issue at https://github.com/nixos/nix/issues
Or feel free to contact the team:
- Matrix: #nix:nixos.org
- IRC: in #nixos on irc.libera.chat
- twitter: @nixos_org
- forum: https://discourse.nixos.org
sam.ainsworth@cs-tze7x4cv-gpu-homedir-350808:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment