Install NixOS on Hetzner Online: Difference between revisions

imported>Grische
m make paths for foo user absolute to avoid ambiguity
imported>Montchr
Update initial Nix and nixos-generators installation steps
Line 85: Line 85:


<syntaxHighlight>
<syntaxHighlight>
# Create a user, because the nix installer
# Create a user, because the nix installer disallows running as root
useradd -m -s /bin/bash foo
adduser --add_extra_groups=sudo foo
install -d -m700 -o foo /nix
install -d -m700 -o foo /nix
su - foo
su - foo
# Pre-configure Nix
echo "build-users-group =" > /etc/nix/nix.conf


# Install Nix
# Install Nix
curl -L https://nixos.org/nix/install | bash
sh <(curl -L https://nixos.org/nix/install) --daemon
 
# As mentioned in the installer, you'll need to log out
# (back to root) and start a new session
exit
su - foo


# Setup Nix
# Optional: Enable flakes
. /home/foo/.nix-profile/etc/profile.d/nix.sh
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf


# Install nixos-generators
# Install nixos-generators
nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i
# This might take a while, so the verbose flag `-v` is included to monitor progress
nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i -v
# Or with flakes:
nix profile install github:nix-community/nixos-generators


# Create a initial config, just to kexec into
# Create a initial config, just to kexec into