pkgs: diff-flake: 0.3.1 -> 0.4.0
Add home-manager configurations.
This commit is contained in:
parent
a5da0abbc2
commit
66fc43f7ca
|
@ -1,7 +1,7 @@
|
||||||
{ lib, coreutils, git, gnused, makeWrapper, stdenvNoCC }:
|
{ lib, coreutils, git, gnused, makeWrapper, stdenvNoCC }:
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenvNoCC.mkDerivation rec {
|
||||||
pname = "diff-flake";
|
pname = "diff-flake";
|
||||||
version = "0.3.1";
|
version = "0.4.0";
|
||||||
|
|
||||||
src = ./diff-flake;
|
src = ./diff-flake;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ add_shell() {
|
||||||
FLAKE_OUTPUTS+=("devShells.$(current_system).\"$1\".inputDerivation")
|
FLAKE_OUTPUTS+=("devShells.$(current_system).\"$1\".inputDerivation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_home() {
|
||||||
|
FLAKE_OUTPUTS+=("homeConfigurations.$1.activationPackage")
|
||||||
|
}
|
||||||
|
|
||||||
add_host() {
|
add_host() {
|
||||||
FLAKE_OUTPUTS+=("nixosConfigurations.$1.config.system.build.toplevel")
|
FLAKE_OUTPUTS+=("nixosConfigurations.$1.config.system.build.toplevel")
|
||||||
}
|
}
|
||||||
|
@ -50,6 +54,10 @@ usage() {
|
||||||
print_err " -p, --previous-rev"
|
print_err " -p, --previous-rev"
|
||||||
print_err " which git revision should be considered the 'previous' state,"
|
print_err " which git revision should be considered the 'previous' state,"
|
||||||
print_err " defaults to HEAD~"
|
print_err " defaults to HEAD~"
|
||||||
|
print_err " --home [name]"
|
||||||
|
print_err " specify the name of a home-manager output configuration whose"
|
||||||
|
print_err " closure should be diffed, can be used multiple times"
|
||||||
|
print_err " if no configuration name is given, defaults to current username"
|
||||||
print_err " --host [name]"
|
print_err " --host [name]"
|
||||||
print_err " specify the name of a NixOS output configuration whose"
|
print_err " specify the name of a NixOS output configuration whose"
|
||||||
print_err " closure should be diffed, can be used multiple times"
|
print_err " closure should be diffed, can be used multiple times"
|
||||||
|
@ -93,6 +101,14 @@ parse_args() {
|
||||||
PREVIOUS_REV="$(git rev-parse "$1")"
|
PREVIOUS_REV="$(git rev-parse "$1")"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--home)
|
||||||
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
|
add_home "$1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
add_home "$USER"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--host)
|
--host)
|
||||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||||
add_host "$1"
|
add_host "$1"
|
||||||
|
@ -122,6 +138,12 @@ parse_args() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_home_configurations() {
|
||||||
|
nix eval '.#homeConfigurations' \
|
||||||
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
--raw
|
||||||
|
}
|
||||||
|
|
||||||
list_nixos_configurations() {
|
list_nixos_configurations() {
|
||||||
nix eval '.#nixosConfigurations' \
|
nix eval '.#nixosConfigurations' \
|
||||||
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||||
|
@ -153,6 +175,9 @@ diff_output() {
|
||||||
parse_args "$@"
|
parse_args "$@"
|
||||||
|
|
||||||
if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
||||||
|
for home in $(list_home_configurations); do
|
||||||
|
add_home "$home"
|
||||||
|
done
|
||||||
for host in $(list_nixos_configurations); do
|
for host in $(list_nixos_configurations); do
|
||||||
add_host "$host"
|
add_host "$host"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue