Nix

Nix has much more packages than Guix. I plan to use it as a version control manager for Common Lisp, and other languages that lack proper version locking, as well as trying new languages & staff, so it's important that I can install new packages with ease.

1. Installation

# Do not use TUNA, they have huge bandwidth pressure.
sh <(curl -L https://mirrors.bfsu.edu.cn/nix/latest/install) --daemon
# Archlinux has nix package.
sudo pacman -S nix

sudo systemctl enable nix-daemon.socket
cat <<EOF | sudo tee /etc/nix/nix.conf
build-users-group = nixbld

# Use mirror from SJTU & USTC.
substituters = https://mirror.sjtu.edu.cn/nix-channels/store https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org/

# Flakes are everywhere, sooner or later we will need to enable it.
experimental-features = nix-command flakes
EOF
sudo systemctl restart nix-daemon.service
nix-channel --add https://mirrors.ustc.edu.cn/nix-channels/nixpkgs-unstable nixpkgs
nix-channel --update

cat <<EOF >~/.profile.d/99-nix-home-manager.sh
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
EOF

2. Home manager

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
ln -sf ~/pylon/bootstrap/home-manager ~/.config/home-manager

Need to add source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh to .profile.

home-manager switch

Updated: 2026-01-18 Sun 07:40