mirror of
https://codeberg.org/mtxyz/nixconf.git
synced 2024-11-12 19:32:35 +00:00
Fixes sysupdate script.
This commit is contained in:
parent
2eb132452b
commit
e73bb63b52
1 changed files with 11 additions and 8 deletions
|
@ -11,15 +11,18 @@ pkgs.writeShellApplication {
|
|||
];
|
||||
|
||||
text = ''
|
||||
NIXCONF="''${NIXCONF:-.}"
|
||||
NIXCONF="''${NIXCONF:-/etc/nixos}"
|
||||
echo Building config from flake at: "$NIXCONF" 1>&2
|
||||
[[ "''${1:-}" == "home" ]] && \
|
||||
home-manager switch -L --flake "$NIXCONF" |& nom && \
|
||||
exit 0
|
||||
[ "$EUID" -eq 0 ] && \
|
||||
if [[ "''${1:-}" == "home" ]]; then
|
||||
home-manager switch -L --flake "$NIXCONF" |& nom
|
||||
exit $?
|
||||
fi
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo Please rerun as root. 1>&2
|
||||
exit 1
|
||||
else
|
||||
nixos-rebuild switch --log-format internal-json -v --flake "$NIXCONF" |& nom --json && \
|
||||
exit 0
|
||||
echo Please rerun as root. 1>&2
|
||||
exit 1
|
||||
exit $?
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue