|
3 months ago | |
---|---|---|
configuration | 3 months ago | |
hosts | 3 months ago | |
lib | 3 months ago | |
modules | 3 months ago | |
nix | 3 months ago | |
.gitignore | 3 months ago | |
README.md | 3 months ago | |
default.nix | 3 months ago |
Notes for handling NixOS systems:
Do not attempt to edit files in
/etc
unless you know exactly what you are doing. Your changes will be overwritten. All changes must be done in this repository and then deployed as explained below.
Build a kexec tarball. Copy the resulting tarball to the machine and kexec:
nix build -f . kexec_tarball
pv ./result/tarball/nixos-system-x86_64-linux.tar.xz | ssh -o UserKnownHostsFile=/dev/null root@$IP "tar -xJC / && /kexec_nixos"
The machine will reboot into a pre-configured ramdisk with all you need to setup a NixOS installation. Perform the usual NixOS installation procedure.
In short form, it's this:
sudo sgdisk \
-o \
-n 1::+1M \
-n 2::+512M \
-n 3:: \
-t 1:ef02 \
/dev/sda
sudo mkfs.ext2 /dev/sda2
sudo mkfs.xfs -m reflink=1 /dev/sda3
sudo mount /dev/sda3 /mnt
sudo mkdir /mnt/boot
sudo mount /dev/sda2 /mnt/boot
sudo nixos-generate-config --root /mnt
# At least configure user and ssh for initial deployment
# Also add yourself to `nix.trustedUsers` to allow remote-built (unsigned) packages to be deployed
sudo $EDITOR /mnt/etc/nixos/configuration.nix
sudo nixos-install
sudo reboot
nix build -f . deploy.ns1 && ./result switch # deploy ns1 host
nix build -f . deploy.dns && ./result switch # deploy dns group