Enhance __yay_rebuild function to include experimental features flag and update help message formatting

This commit is contained in:
Chris Toph 2025-05-29 00:01:35 -04:00
parent 92d557d0d0
commit 7bb8f702dc
2 changed files with 27 additions and 14 deletions

View file

@ -1,12 +1,13 @@
function __yay_rebuild function __yay_rebuild
set -l opts h/help 'p/path=' 'H/host=' t/trace set -l opts h/help 'p/path=' 'H/host=' t/trace e/experimental
argparse $opts -- $argv; or return argparse $opts -- $argv; or return
if set -q _flag_help if set -q _flag_help
echo "Usage: yay rebuild [OPTIONS]" echo "Usage: yay rebuild [OPTIONS]"
echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)" echo " -h, --help Show this help message"
echo " -H, --host HOST Hostname to build for (default: current hostname)" echo " -e, --experimental Enable experimental features (flakes and nix-commands)"
echo " -t, --trace Enable trace output" echo " -H, --host HOST Hostname to build for (default: current hostname)"
echo " -h, --help Show this help message" echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)"
echo " -t, --trace Enable trace output"
return return
end end
set flake_path (__yay_get_flake_path $_flag_path); or return set flake_path (__yay_get_flake_path $_flag_path); or return
@ -19,10 +20,22 @@ function __yay_rebuild
__yay_green "««« REBUILDING NIXOS ($host) »»»" __yay_green "««« REBUILDING NIXOS ($host) »»»"
set orig (pwd) set orig (pwd)
cd $flake_path cd $flake_path
# Base command
set -l cmd "nh os switch . -H $host -- --impure"
# Add trace if requested
if set -q _flag_trace if set -q _flag_trace
__yay_run "nh os switch . -H $host -- --impure --show-trace" set cmd "$cmd --show-trace"
else
__yay_run "nh os switch . -H $host -- --impure"
end end
# Add experimental features if requested
if set -q _flag_experimental
set cmd "$cmd --extra-experimental-features flakes --extra-experimental-features nix-commands"
end
# Run the command
__yay_run $cmd
cd $orig cd $orig
end end