summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/install-system/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-01-10 13:20:04 +0100
committermakefu <github@syntax-fehler.de>2023-01-10 13:20:04 +0100
commitc691e94c45e6c5bdac531186374b185ea1790311 (patch)
tree024f2e5b8aed015687f03b31b6e7c1ce743f009c /lass/5pkgs/install-system/default.nix
parent1929733c03dbff92f830cb81b57cf4ccf859d364 (diff)
parent2818476f710410f1c752ce12becce10be0a8a293 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/5pkgs/install-system/default.nix')
-rw-r--r--lass/5pkgs/install-system/default.nix26
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 00000000..9a392e66
--- /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
+''