Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Last active September 16, 2024 03:50
Show Gist options
  • Save heywoodlh/535deea20a2a5b13339d1ee096bf6692 to your computer and use it in GitHub Desktop.
Save heywoodlh/535deea20a2a5b13339d1ee096bf6692 to your computer and use it in GitHub Desktop.
Commands to install Nix on new Alpine Linux host
# Enable the community repository
sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
# Install Nix package
apk add --no-cache nix shadow
# Assuming you're running as root
# Add user to the nix group
# Using shadow because I'm incompetent
myuser=heywoodlh
usermod -aG nix $myuser
# Configure Nix for flakes
cat <<EOF > /etc/nix/nix.conf
allowed-users = @nix
build-users-group = nixbld
max-jobs = 4
extra-experimental-features = nix-command flakes
EOF
# Enable nix-daemon on boot
rc-update add nix-daemon
rc-service nix-daemon restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment