aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/install-with-disko
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install-with-disko')
-rwxr-xr-xscripts/install-with-disko27
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/install-with-disko b/scripts/install-with-disko
index 7ae4e8e..a6210b9 100755
--- a/scripts/install-with-disko
+++ b/scripts/install-with-disko
@@ -1,6 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell -i zsh --packages rsync zsh
+# load module to parse command line arguments
+zmodload zsh/zutil
+
+# parse any possible additional drive declarations
+zparseopts -D -E -A opts -- -skip-disko h
+
setopt ERR_EXIT NO_UNSET PIPE_FAIL
DIR="${0:h}"
@@ -62,15 +68,22 @@ echo
if [[ "${REPLY}" == "y" ]]; then
sudo true
- sudo nix run github:nix-community/disko \
- --extra-experimental-features "nix-command flakes" \
- --no-write-lock-file \
- -- \
- --mode zap_create_mount \
- "${DIR}/../hosts/${TARGET_HOST}/disks.nix"
+
+ if (( ! ${+opts[--skip-disko]} )); then
+ sudo nix run github:nix-community/disko \
+ --extra-experimental-features "nix-command flakes" \
+ --no-write-lock-file \
+ -- \
+ --mode zap_create_mount \
+ "${DIR}/../hosts/${TARGET_HOST}/disks.nix"
+ fi
# rsync NixOS configuration to target host file system and install the system
- sudo mkdir -p /mnt/etc/nixos
+
+ if [[ ! -d /mnt/etc/nixos ]]; then
+ sudo mkdir -p /mnt/etc/nixos
+ fi
+
sudo rsync -a --delete --exclude .git "${DIR}/.." /mnt/etc/nixos
cd /mnt/etc/nixos
sudo nixos-install --flake ".#${TARGET_HOST}"