pkgs: diff-flake: add system-manager support
This commit is contained in:
parent
eb59aa14e8
commit
fae47faaff
1 changed files with 25 additions and 0 deletions
|
|
@ -41,6 +41,10 @@ add_shell() {
|
||||||
FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation")
|
FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_system() {
|
||||||
|
FLAKE_OUTPUTS+=("systemConfigs.\"$1\".config.system.build.toplevel")
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
print_err "Usage: $0 [option]... [-- [nix build option]...]"
|
print_err "Usage: $0 [option]... [-- [nix build option]...]"
|
||||||
print_err ""
|
print_err ""
|
||||||
|
|
@ -74,6 +78,10 @@ usage() {
|
||||||
print_err " specify a specific devShell configuration name whose closure"
|
print_err " specify a specific devShell configuration name whose closure"
|
||||||
print_err " should be diffed, can be used multiple times"
|
print_err " should be diffed, can be used multiple times"
|
||||||
print_err " if no name is given, defaults to 'default'"
|
print_err " if no name is given, defaults to 'default'"
|
||||||
|
print_err " --system [name]"
|
||||||
|
print_err " specify the name of a system-manager output configuration whose"
|
||||||
|
print_err " closure should be diffed, can be used multiple times"
|
||||||
|
print_err " if no host name is given, defaults to current hostname"
|
||||||
print_err ""
|
print_err ""
|
||||||
print_err "when no flake outputs are specified, automatically queries for"
|
print_err "when no flake outputs are specified, automatically queries for"
|
||||||
print_err "all NixOS configurations, and devShells for current system"
|
print_err "all NixOS configurations, and devShells for current system"
|
||||||
|
|
@ -141,6 +149,14 @@ parse_args() {
|
||||||
add_shell "default"
|
add_shell "default"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--system)
|
||||||
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
|
add_system "$1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
add_system "$(hostname)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
NIX_BUILD_ARGS=("$@")
|
NIX_BUILD_ARGS=("$@")
|
||||||
break
|
break
|
||||||
|
|
@ -178,6 +194,12 @@ list_dev_shells() {
|
||||||
--raw
|
--raw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_system_configurations() {
|
||||||
|
nix eval '.#systemConfigs' \
|
||||||
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
--raw
|
||||||
|
}
|
||||||
|
|
||||||
diff_output() {
|
diff_output() {
|
||||||
local PREV NEW
|
local PREV NEW
|
||||||
PREV="$(mktemp --dry-run)"
|
PREV="$(mktemp --dry-run)"
|
||||||
|
|
@ -209,6 +231,9 @@ if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
||||||
for shell in $(list_dev_shells); do
|
for shell in $(list_dev_shells); do
|
||||||
add_shell "$shell"
|
add_shell "$shell"
|
||||||
done
|
done
|
||||||
|
for system in $(list_system_configurations); do
|
||||||
|
add_system "$system"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for out in "${FLAKE_OUTPUTS[@]}"; do
|
for out in "${FLAKE_OUTPUTS[@]}"; do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue