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
|
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
|
||||||
|
|
|
@ -17,10 +17,10 @@ let
|
||||||
# Create main yay binary that correctly passes args to fish
|
# Create main yay binary that correctly passes args to fish
|
||||||
yayBin = pkgs.writeShellScriptBin "yay" ''
|
yayBin = pkgs.writeShellScriptBin "yay" ''
|
||||||
FUNCTIONS_DIR=$(dirname $(dirname $0))/share/fish/functions
|
FUNCTIONS_DIR=$(dirname $(dirname $0))/share/fish/functions
|
||||||
|
|
||||||
# Create a temporary script to handle command execution
|
# Create a temporary script to handle command execution
|
||||||
TEMP_SCRIPT=$(mktemp -t yay-command.XXXXXX)
|
TEMP_SCRIPT=$(mktemp -t yay-command.XXXXXX)
|
||||||
|
|
||||||
# Write the fish commands to the script
|
# Write the fish commands to the script
|
||||||
cat > $TEMP_SCRIPT << EOF
|
cat > $TEMP_SCRIPT << EOF
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
@ -28,10 +28,10 @@ let
|
||||||
source $FUNCTIONS_DIR/yay.fish
|
source $FUNCTIONS_DIR/yay.fish
|
||||||
yay_function $@
|
yay_function $@
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Execute the script
|
# Execute the script
|
||||||
${lib.getExe pkgs.fish} $TEMP_SCRIPT "$@"
|
${lib.getExe pkgs.fish} $TEMP_SCRIPT "$@"
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm $TEMP_SCRIPT
|
rm $TEMP_SCRIPT
|
||||||
'';
|
'';
|
||||||
|
@ -69,4 +69,4 @@ pkgs.symlinkJoin {
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
maintainers = [ "Tophc7" ];
|
maintainers = [ "Tophc7" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue