Install NixOS on Kimsufi: Difference between revisions

imported>Kha
Created page with "This guide explains how to install NixOS on [https://www.kimsufi.com/en/ Kimsufi] machines from the rescue system. It is based on [https://mgdm.net/weblog/nixos-on-kimsufi/ th..."
 
Klinger (talk | contribs)
 
(3 intermediate revisions by one other user not shown)
Line 37: Line 37:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Create a user for the install process
useradd -m setupuser
# Create a user for the Nix daemon
# Create a user for the Nix daemon
groupadd -g 30000 nixbld
groupadd -g 30000 nixbld
useradd -u 30000 -g nixbld -G nixbld nixbld
useradd -u 30000 -g nixbld -G nixbld nixbld
useradd -m setupuser


# Set this to something you will remember, you'll need it in a moment
# Set this to something you will remember, you'll need it in a moment
passwd setupuser  
passwd setupuser  


sed s/root/setupuser/ /etc/sudoers -i
# Give sudo rights to your user
su setupuser -s /bin/bash
echo "setupuser   ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/setupuser
su setupuser -s /bin/bash -l
 
# Disable sandboxing as it doesn't work in tmpfs mounted systems
# see: https://github.com/NixOS/nix/issues/5934
sudo mkdir -p /etc/nix/
echo "sandbox = false" | sudo tee -a /etc/nix/nix.conf


  # Install Nix
  # Install Nix
Line 56: Line 63:


# The default channel is `nixpkgs-unstable`, let's switch to a stable NixOS channel
# The default channel is `nixpkgs-unstable`, let's switch to a stable NixOS channel
nix-channel --add https://nixos.org/channels/nixos-21.11 nixpkgs
nix-channel --add https://nixos.org/channels/nixos-22.11 nixpkgs
nix-channel --update
nix-channel --update


Line 110: Line 117:


You will probably encounter an error when you connect because the SSH host key will have changed. You can fix this with ssh-keygen -R 192.0.2.1 (replacing the IP with the one for your machine), and then try again. Hopefully you’ve now got a new NixOS machine up and running and ready to do whatever you need it to do.
You will probably encounter an error when you connect because the SSH host key will have changed. You can fix this with ssh-keygen -R 192.0.2.1 (replacing the IP with the one for your machine), and then try again. Hopefully you’ve now got a new NixOS machine up and running and ready to do whatever you need it to do.
[[Category:Deployment]]