diff options
author | lassulus <lassulus@lassul.us> | 2022-12-28 11:19:37 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-12-28 11:29:48 +0100 |
commit | 5c6815ff41d04a460e5e35cf34639fb34185e65f (patch) | |
tree | 8283873a9af8335842da36a6f782b4bf5bbe19c0 /lass/5pkgs | |
parent | adc11cf679970da26f82e5200f2ea2a94c59e8be (diff) |
l install-system: init helper script to install systems
Diffstat (limited to 'lass/5pkgs')
-rw-r--r-- | lass/5pkgs/install-system/default.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lass/5pkgs/install-system/default.nix b/lass/5pkgs/install-system/default.nix new file mode 100644 index 000000000..9a392e669 --- /dev/null +++ b/lass/5pkgs/install-system/default.nix @@ -0,0 +1,26 @@ +{ pkgs }: +pkgs.writers.writeDashBin "install-system" '' + set -efux + SYSTEM=$1 + TARGET=$2 + # format + if ! (sshn "$TARGET" -- mountpoint /mnt); then + nix run github:numtide/nixos-remote -- --stop-after-disko --store-paths "$(nix-build --no-out-link -I stockholm="$HOME"/sync/stockholm -I nixos-config="$HOME"/sync/stockholm/lass/1systems/"$SYSTEM"/physical.nix '<nixpkgs/nixos>' -A config.system.build.diskoNoDeps)" /dev/null "$TARGET" + fi + + # install dependencies + sshn "$TARGET" << SSH + nix-channel --update + nix-env -iA nixos.git + SSH + + # populate + $(nix-build --no-out-link "$HOME"/sync/stockholm/lass/krops.nix -A populate --argstr name "$SYSTEM" --argstr target "$TARGET"/mnt/var/src --arg force true) + + # install + sshn "$TARGET" << SSH + ln -s /mnt/var/src /var/src + NIXOS_CONFIG=/var/src/nixos-config nixos-install --no-root-password -I /var/src + zpool export -fa + SSH +'' |