]> Git — Sourcephile - julm/julm-nix.git/blob - install
install: document when offline
[julm/julm-nix.git] / install
1 #!/bin/sh -eux
2 if test "$(id -u)" != 0
3 then sudo "$0" "$@"
4 else
5 cd "${0%/*}"
6 chmod -R g-rwx,o-rwx "$PWD/private/root"
7 ln -sfn "$PWD/private/root" /root/private
8 trap 'git reset private/root' EXIT
9 git rm -rf --cached --ignore-unmatch private/root # prevent copying to /nix/store
10 # To build offline, use: --option no-net 1 --option substituters ""
11 time nixos-rebuild switch --flake . "$@"
12 nix-env --delete-generations +9 --profile /nix/var/nix/profiles/system
13 fi