Deployment scripts for my PC / laptop / servers ...
- Boot nixos livecd on remote host
- Prepare hardware configure
- Prepare filesystem and generate hardware configure via
nixos-generate-config --root /mnt
- Copy nix files from
/mnt/etc/nixos
tohosts/nixos/${host}
in this repo.
- Prepare filesystem and generate hardware configure via
- Prepare age key
age-keygen
and copy age key to/var/lib/sops/key.txt
on remote host.- Update
.sops.yaml
and update secrets via./secrets/updatekeys.sh
- Build nixos on local host:
nix build .#nixosConfigurations.${host}.config.system.build.toplevel
- Copy result to remote:
nix copy --to "ssh://root@${host}?remote-store=/mnt" ./result
- Set system profile:
nix-env --store /mnt -p /mnt/nix/var/nix/profiles/system --set $(readlink ./result)
- Setup bootloader:
NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "/mnt" -c "/run/current-system/bin/switch-to-configuration boot"
- Please ensure that decryption is work in nixos-enter before reboot
- Split v2ray config for different hosts