Changes sysupdate to package instead of shell.

This commit is contained in:
Bailey 2024-01-18 00:33:09 -05:00
parent 75a2a93d37
commit 0959b72aa1
2 changed files with 25 additions and 21 deletions

View file

@ -0,0 +1,25 @@
{
pkgs,
...
}:
pkgs.writeShellApplication {
name = "sysupdate";
runtimeInputs = with pkgs; [
nix-output-monitor nixos-rebuild home-manager
];
text = ''
NIXCONF="''${NIXCONF:-.}"
echo Building config from flake at: "$NIXCONF" 1>&2
[[ "''${1:-}" == "home" ]] && \
home-manager switch -L --flake "$NIXCONF" |& nom && \
exit 0
[ "$EUID" -eq 0 ] && \
nixos-rebuild switch --log-format internal-json -v --flake "$NIXCONF" |& nom --json && \
exit 0
echo Please rerun as root. 1>&2
exit 1
'';
}

View file

@ -1,21 +0,0 @@
{
pkgs,
inputs,
...
}:
pkgs.mkShell {
packages = with pkgs; [
nix-output-monitor nixos-rebuild home-manager
];
NIXCONF = inputs.self;
shellHook = ''
alias sysupdate-nixos='sudo echo -n; sudo nixos-rebuild switch --log-format internal-json -v --flake "$NIXCONF" |& nom --json'
alias sysupdate-home='home-manager switch -L --flake "$NIXCONF" |& nom'
echo System Update Shell for flake at $NIXCONF
echo Run 'sysupdate-nixos' to update system,
echo then 'sysupdate-home' to update user profile.
'';
}