Fixes sysupdate script.

This commit is contained in:
Bailey 2024-01-22 23:05:30 -05:00
parent 2eb132452b
commit e73bb63b52

View file

@ -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
'';
}