From 9eef6693a5bcdd5472ae0eb8650745a503d86c5f Mon Sep 17 00:00:00 2001 From: Bailey Stevens Date: Mon, 19 Feb 2024 01:16:05 -0500 Subject: [PATCH] Uses fish argparse for update-sys fn. --- modules/home/core/default.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/home/core/default.nix b/modules/home/core/default.nix index d4524af..d52a532 100644 --- a/modules/home/core/default.nix +++ b/modules/home/core/default.nix @@ -241,8 +241,21 @@ in set -l last_argv $argv echo \"$argv[1]\" Command Not Found ''; - update-hm = "home-manager switch -L --flake nixconf &| nom"; - update-sys = "sudo nixos-rebuild switch --log-format internal-json -v --flake nixconf &| nom --json"; + update-sys = '' + argparse -i 'f/flake=' -- $argv + set -f mode switch + if set -q argv[1] + set -f mode $argv[1] + end + + set -f flake nixconf + if set -q _flag_f + set -f flake $_flag_f + end + + sudo echo -n # Make sure sudo has already prompted for password. + sudo nixos-rebuild $mode --log-format internal-json -v --flake $flake &| nom --json + ''; }; interactiveShellInit = '' abbr --position anywhere -a !! -f last_cmd