Install these if not already available:
sudo apt install curl xz-utils
OR using build-essential
(includes gcc
, xz-utils
, etc.)
sudo apt install curl build-essential
sudo mkdir /nix
sudo chown username /nix # replace `username` with your own
sh <(curl -L https://nixos.org/nix/install) --no-daemon
nix-env -i hello # install to test
nix-env --uninstall hello # remove test
# see https://search.nixos.org/packages
nix-env -qa > nix-packages.list
# see https://nixos.org/nix/manual
nix-env -i neovim # example install
# optimise store
nix-store --optimise -v
Auto-optimise store when writing new files to it:
mkdir -p ~/.config/nix
echo "auto-optimise-store = true" >> ~/.config/nix/nix.conf
Faster to type:
alias nxi='nix-env -i' # install
alias nxu='nix-env -u' # update
alias nxr='nix-env -e' # remove
alias nxls='nix-env -q' # list
alias nxgc='nix-collect-garbage -d'
https://ariya.io/2020/05/nix-package-manager-on-ubuntu-or-debian