oignon: openvpn: disable calyx
[julm/julm-nix.git] / install
diff --git a/install b/install
index cfaae6ff1d59c3beba263e0355fdf3a8e3a222b8..6ae60dea3896ae3b915e1b1d9992d4f8dab9f4b0 100755 (executable)
--- a/install
+++ b/install
@@ -1,7 +1,9 @@
 #!/bin/sh -eux
-if test $(id -u) != 0
-then sudo "$0" "$@"
-else
-  nixos-rebuild switch --flake "${0%/*}"/ "$@"
-  nix-env --delete-generations +2 --profile /nix/var/nix/profiles/system
-fi
+cd "${0%/*}"
+chmod -R g-rwx,o-rwx "$PWD/private/root"
+trap 'git reset private/root private/hosts/*/root' EXIT
+git rm -rf --cached --ignore-unmatch private/root private/hosts/*/root # prevent copying to /nix/store
+sudo ln -sfn "$PWD/private/root" /root/private
+# To build offline, use: --offline
+sudo time nixos-rebuild switch --flake . "$@"
+sudo nix-env --delete-generations 7d --profile /nix/var/nix/profiles/system