podl: tweak names
[julm/julm-nix.git] / build
diff --git a/build b/build
index 09d11a63dfacdb8e8fa0293f06c2129ad3c2c249..a3fac6f7e65f6b07738be3ec382f1b7c9471bfbd 100755 (executable)
--- a/build
+++ b/build
@@ -1,6 +1,10 @@
 #!/bin/sh -eux
 cd "${0%/*}"
-chmod -R g-rwx,o-rwx "$PWD/private/root"
-trap 'git reset private/root' EXIT
-git rm -rf --cached --ignore-unmatch private/root # prevent copying to /nix/store
-time nix -L build .\#nixosConfigurations."$1".config.system.build.toplevel
+host=$1
+shift
+chmod -R g-rwx,o-rwx private/root "$PWD"/private/hosts/*/root
+trap 'git reset private/root private/hosts' EXIT
+# prevent copying to /nix/store
+git rm -rf --cached --ignore-unmatch private/root private/hosts/*
+git reset private/hosts/"$host"/credentials private/hosts/"$host"/root/machine-id
+time nix -L build "$@" -o hosts/"$host".root .\#nixosConfigurations."$host".config.system.build.toplevel