Nix install

From wikinotes

Documentation

multi user install https://nixos.org/nix/manual/#sect-multi-user-installation
nix flakes install https://github.com/mschwaig/howto-install-nix-with-flake-support
nix flakes repo/branch https://github.com/NixOS/nix/tree/flakes

Nix

Archlinux

Interactive Install

Install nix

curl -L https://nixos.org/nix/install > install
sh install --daemon

# in new shell
# (if nix permission error, reboot, try again)
nix-shell -p nix-info --run "nix-info -m"

Upgrade nix

# configure default channel
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -u

Test install

nix-shell -p vim

Automatable Install

NOTE:

Nix's install script downloads a tarball to /tmp. Begin running installed, and check extracted install script for options.

# as a user w/ passwordless sudo privileges
yes | sh <(curl -L https://nixos.org/nix/install) --daemon
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -u


(outdated) aur install instructions 


pacaur -S archlinux-nix
pacaur -S nix

# setup build groups and bootstrap system
archlinux-nix setup-build-group
archlinux-nix bootstrap

# configure default channel
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -u

# reboot so that changes take effect (?)

(Optional) Run as non-privileged user

sudo groupadd --system nix
sudo usermod -aG nix will
newgrp nix

useradd chown -R root:nix /nix/var/nix/{gcroots,profiles}
nix-channel --update

Nix Flakes

Nix flakes is an alternative/experimental package repo.

nix-env -iA nixpkgs.nixFlakes

Add to ~/.config/nix/nix.conf

# ~/.config/nix/nix.conf
experimental-features = nix-command flakes

verify

nix flake --help