46 lines
1.5 KiB
Makefile
46 lines
1.5 KiB
Makefile
|
[private]
|
||
|
@default:
|
||
|
just --list
|
||
|
|
||
|
[private]
|
||
|
nix-build NAME ATTR:
|
||
|
nix build ..#nixosConfigurations.{{ NAME }}.config.system.build.{{ ATTR }} --out-link ./output/{{ ATTR }}
|
||
|
|
||
|
[private]
|
||
|
nix-copy HOST ATTR:
|
||
|
nix copy --substitute-on-destination --no-check-sigs --to 'ssh-ng://{{ HOST }}' ./output/{{ ATTR }}
|
||
|
|
||
|
# partition disk using disko
|
||
|
disko NAME HOST:
|
||
|
@just nix-build {{ NAME }} diskoScript
|
||
|
@just nix-copy {{ HOST }} diskoScript
|
||
|
ssh {{ HOST }} $(realpath ./output/diskoScript)
|
||
|
|
||
|
# generate ssh keys
|
||
|
ssh-keygen _NAME HOST:
|
||
|
ssh {{ HOST }} mkdir -m 0755 -p /mnt/persist/etc/ssh
|
||
|
ssh {{ HOST }} ssh-keygen -t "rsa" -b 4096 -f "/mnt/persist/etc/ssh/ssh_host_rsa_key" -N \"\"
|
||
|
ssh {{ HOST }} ssh-keygen -t "ed25519" -f "/mnt/persist/etc/ssh/ssh_host_ed25519_key" -N \"\"
|
||
|
ssh {{ HOST }} cat /mnt/persist/etc/ssh/ssh_host_ed25519_key.pub | nix run nixpkgs#ssh-to-age
|
||
|
|
||
|
# FIXME:
|
||
|
# https://askubuntu.com/questions/1110828/ssh-failed-to-start-missing-privilege-separation-directory-var-run-sshd
|
||
|
ssh {{ HOST }} mkdir -m 0755 -p /mnt/persist/var/run/sshd
|
||
|
|
||
|
# build system configuration
|
||
|
build NAME HOST:
|
||
|
@just nix-build {{ NAME }} toplevel
|
||
|
@just nix-copy {{ HOST }}?remote-store=local?root=/mnt toplevel
|
||
|
|
||
|
# run nixos-install
|
||
|
install _NAME HOST:
|
||
|
ssh {{ HOST }} nixos-install --root /mnt --system $(realpath ./output/toplevel) --no-channel-copy --no-root-passwd
|
||
|
|
||
|
# reboot
|
||
|
reboot _NAME HOST:
|
||
|
ssh {{ HOST }} reboot
|
||
|
|
||
|
# cleanup files
|
||
|
cleanup _NAME HOST:
|
||
|
rm -r ./output
|