shell.nix: run nix build as root
Variables mist be preserved so use `sudo -E`. Fixes #4.
This commit is contained in:
parent
0bf18acdd4
commit
6d537c35c4
@ -32,6 +32,7 @@ git add ./hosts/${new_host}.nix
|
|||||||
|
|
||||||
# You can specify any of the host configurations living in the ./hosts
|
# You can specify any of the host configurations living in the ./hosts
|
||||||
# directory. If omitted, it will default to your systems current hostname.
|
# directory. If omitted, it will default to your systems current hostname.
|
||||||
|
# This will be run as root.
|
||||||
rebuild $new_host switch
|
rebuild $new_host switch
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -10,9 +10,9 @@ let
|
|||||||
elif [[ $1 == "iso" ]]; then
|
elif [[ $1 == "iso" ]]; then
|
||||||
nix build ${configs}.niximg.${build}.isoImage
|
nix build ${configs}.niximg.${build}.isoImage
|
||||||
elif [[ -z $2 ]]; then
|
elif [[ -z $2 ]]; then
|
||||||
nix run -vv ${configs}.${hostname}.${build}.toplevel -c switch-to-configuration $1
|
sudo -E nix run -vv ${configs}.${hostname}.${build}.toplevel -c switch-to-configuration $1
|
||||||
else
|
else
|
||||||
nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2
|
sudo -E nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
|
Loading…
Reference in New Issue
Block a user