nixpkgs: update to latest
[julm/julm-nix.git] / install
diff --git a/install b/install
index 73a137c94c987f7a701119714598d3e2d73fe70e..cfaae6ff1d59c3beba263e0355fdf3a8e3a222b8 100755 (executable)
--- a/install
+++ b/install
@@ -1,3 +1,7 @@
 #!/bin/sh -eux
-sudo nixos-rebuild switch --flake "${0%/*}"/ "$@"
-sudo nix-env --delete-generations +2 --profile /nix/var/nix/profiles/system
+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