30 lines
625 B
Bash
Executable File
30 lines
625 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
NIX_EVAL_CMD="nix eval --json --no-warn-dirty --apply builtins.attrNames"
|
|
|
|
list_flake_attr() {
|
|
attr="$1"
|
|
flake="${2:-.}"
|
|
echo "${attr} [${flake}]:"
|
|
$NIX_EVAL_CMD "${flake}#${attr}" | jq -r '" - " + .[]'
|
|
echo
|
|
}
|
|
|
|
list_home_modules() {
|
|
list_flake_attr "homeModules" "$1"
|
|
}
|
|
|
|
list_home_configurations() {
|
|
list_flake_attr "homeConfigurations" "$1"
|
|
}
|
|
|
|
list_nixos_configurations() {
|
|
list_flake_attr "nixosConfigurations" "$1"
|
|
}
|
|
|
|
current_dir=$(readlink -f .)
|
|
flake="${1:-$current_dir}"
|
|
list_home_modules "$flake"
|
|
list_home_configurations "$flake"
|
|
list_nixos_configurations "$flake"
|