aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMark Nipper <nipsy@bitgnome.net>2024-05-03 00:24:31 -0700
committerMark Nipper <nipsy@bitgnome.net>2024-05-03 00:24:31 -0700
commitbb455452a10edc9294f4f8e34b62bf01e9906c0a (patch)
treebd65ca61dd1917b7b86eb60fbf7d5ff3850771ef /scripts
parentb34b8ee3f568f2dcb3e1b3fc63737c1ec8f464d3 (diff)
downloadnix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar.gz
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar.bz2
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar.lz
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar.xz
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.tar.zst
nix-bb455452a10edc9294f4f8e34b62bf01e9906c0a.zip
Add skip option
Diffstat (limited to 'scripts')
-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}"