Enhance __yay_rebuild function to include experimental features flag and update help message formatting
This commit is contained in:
parent
92d557d0d0
commit
7bb8f702dc
2 changed files with 27 additions and 14 deletions
|
@ -1,12 +1,13 @@
|
|||
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
|
||||
if set -q _flag_help
|
||||
echo "Usage: yay rebuild [OPTIONS]"
|
||||
echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)"
|
||||
echo " -H, --host HOST Hostname to build for (default: current hostname)"
|
||||
echo " -t, --trace Enable trace output"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -e, --experimental Enable experimental features (flakes and nix-commands)"
|
||||
echo " -H, --host HOST Hostname to build for (default: current hostname)"
|
||||
echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)"
|
||||
echo " -t, --trace Enable trace output"
|
||||
return
|
||||
end
|
||||
set flake_path (__yay_get_flake_path $_flag_path); or return
|
||||
|
@ -19,10 +20,22 @@ function __yay_rebuild
|
|||
__yay_green "««« REBUILDING NIXOS ($host) »»»"
|
||||
set orig (pwd)
|
||||
cd $flake_path
|
||||
|
||||
# Base command
|
||||
set -l cmd "nh os switch . -H $host -- --impure"
|
||||
|
||||
# Add trace if requested
|
||||
if set -q _flag_trace
|
||||
__yay_run "nh os switch . -H $host -- --impure --show-trace"
|
||||
else
|
||||
__yay_run "nh os switch . -H $host -- --impure"
|
||||
set cmd "$cmd --show-trace"
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,10 +17,10 @@ let
|
|||
# Create main yay binary that correctly passes args to fish
|
||||
yayBin = pkgs.writeShellScriptBin "yay" ''
|
||||
FUNCTIONS_DIR=$(dirname $(dirname $0))/share/fish/functions
|
||||
|
||||
|
||||
# Create a temporary script to handle command execution
|
||||
TEMP_SCRIPT=$(mktemp -t yay-command.XXXXXX)
|
||||
|
||||
|
||||
# Write the fish commands to the script
|
||||
cat > $TEMP_SCRIPT << EOF
|
||||
#!/usr/bin/env fish
|
||||
|
@ -28,10 +28,10 @@ let
|
|||
source $FUNCTIONS_DIR/yay.fish
|
||||
yay_function $@
|
||||
EOF
|
||||
|
||||
|
||||
# Execute the script
|
||||
${lib.getExe pkgs.fish} $TEMP_SCRIPT "$@"
|
||||
|
||||
|
||||
# Clean up
|
||||
rm $TEMP_SCRIPT
|
||||
'';
|
||||
|
@ -69,4 +69,4 @@ pkgs.symlinkJoin {
|
|||
platforms = platforms.unix;
|
||||
maintainers = [ "Tophc7" ];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue