2023-01-26 15:14:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -efux
|
|
|
|
|
|
|
|
disk=$1
|
|
|
|
|
|
|
|
export NIXPKGS_ALLOW_UNFREE=1
|
2023-01-26 22:46:51 +00:00
|
|
|
(umask 077; pass show admin/hilum/luks > /tmp/hilum.luks)
|
|
|
|
trap 'rm -f /tmp/hilum.luks' EXIT
|
2023-01-26 15:14:47 +00:00
|
|
|
stockholm_root=$(git rev-parse --show-toplevel)
|
|
|
|
ssh root@localhost -t -- $(nix-build \
|
|
|
|
--no-out-link \
|
|
|
|
-I nixpkgs=/var/src/nixpkgs \
|
|
|
|
-I stockholm="$stockholm_root" \
|
|
|
|
-I secrets="$stockholm_root"/lass/2configs/tests/dummy-secrets \
|
2023-01-26 22:46:51 +00:00
|
|
|
-E "with import <nixpkgs> {}; (pkgs.nixos [
|
|
|
|
{
|
|
|
|
luksPassFile = \"/tmp/hilum.luks\";
|
|
|
|
mainDisk = \"$disk\";
|
|
|
|
disko.rootMountPoint = \"/mnt/hilum\";
|
|
|
|
}
|
|
|
|
./physical.nix
|
|
|
|
]).disko"
|
2023-01-26 15:14:47 +00:00
|
|
|
)
|
2023-01-26 22:46:51 +00:00
|
|
|
rm -f /tmp/hilum.luks
|
2023-01-26 15:14:47 +00:00
|
|
|
$(nix-build \
|
|
|
|
--no-out-link \
|
|
|
|
-I nixpkgs=/var/src/nixpkgs \
|
|
|
|
"$stockholm_root"/lass/krops.nix -A populate \
|
|
|
|
--argstr name hilum \
|
|
|
|
--argstr target "root@localhost/mnt/hilum/var/src" \
|
|
|
|
--arg force true
|
|
|
|
)
|
|
|
|
ssh root@localhost << SSH
|
2023-01-26 22:46:51 +00:00
|
|
|
NIXOS_CONFIG=/mnt/hilum/var/src/nixos-config nixos-install --no-root-password --root /mnt/hilum -I /var/src
|
2023-01-26 15:14:47 +00:00
|
|
|
nixos-enter --root /mnt/hilum -- nixos-rebuild -I /var/src switch --install-bootloader
|
|
|
|
umount -Rv /mnt/hilum
|
|
|
|
SSH
|