This commit is contained in:
2025-11-23 13:37:15 +01:00
parent 4e5c902c78
commit d60803ab67
+8 -3
View File
@@ -18,6 +18,10 @@ export FZF_DEFAULT_OPTS := "--height 15 --cycle --bind 'ctrl-a:toggle-all' " + e
# deal with concurrency
export GIT := `command -v git-wait >/dev/null && echo "git-wait" || echo "git"`
# select the fastest jq available, xq > gojq > jq, but xq is missing many features, and gojq is missing some features
export JQ_GOJQ := `command -v "gojq" >/dev/null && echo gojq || echo "jq"`
export JQ_XQ := `command -v xq >/dev/null && echo "xq" || { command -v "gojq" >/dev/null && echo gojq || echo "jq" ;}`
# trigger a direnv reload when entering $SHELL
export DIRENV_WATCHES := ""
@@ -30,6 +34,7 @@ XARGS_NL := "-d'\\n' --no-run-if-empty"
NIX_EVAL_OPTS := "--log-format raw --option warn-dirty false"
# required programs: git nix nom gum fzf tee nix-update jq fd xe sd
# optional programs: gojq xq
@_default:
cd "$invokedir"; just "$(gum filter $(just --summary --unsorted | tr ' ' '\n' | grep -vxE 'commit|fixup|list|build'))"
@@ -67,7 +72,7 @@ list-packages +$cut_args="-c1-": _packages_json
#!/usr/bin/env -S bash -euo pipefail
cachefile=/tmp/nixpkgs-packages.json.tsv
if ! [[ -s "$cachefile" && "$cachefile" -nt packages.json ]]; then
jq <packages.json 'to_entries[] | select(.value.meta.position==null|not) | [.key, .value.meta.position] | @tsv' -r \
$JQ_XQ <packages.json 'to_entries[] | select(.value.meta.position==null|not) | [.key, .value.meta.position] | @tsv' -r \
| tr '0123456789' '9876543210' | sort | tr '0123456789' '9876543210' \
| sed -e 's#:\([0-9]*\)$#\t\1#' \
| grep . >"$cachefile"
@@ -148,7 +153,7 @@ list-packages-by-maintainer *github_handles: _packages_json
[[ "${#maintainers[@]}" -gt 0 ]]
#grep </tmp/nixpkgs-maintainers.tsv -F "$(printf "%s\t\n" "${maintainers[@]}")"
maintainers_json=$(printf "%s\n" "${maintainers[@]}" | jq -sR 'split("\n")|map(select(.==""|not))' -c)
jq <packages.json --argjson maintainers "$maintainers_json" 'to_entries[] | select([.value.meta.maintainers // [] | .[] | .github as $maintainer | $maintainers[] | . == $maintainer] | any) | .key' -r \
$JQ_GOJQ <packages.json --argjson maintainers "$maintainers_json" 'to_entries[] | select([.value.meta.maintainers // [] | .[] | .github as $maintainer | $maintainers[] | . == $maintainer] | any) | .key' -r \
| tr '0123456789' '9876543210' | sort -u | tr '0123456789' '9876543210'
[no-cd]
@@ -1082,7 +1087,7 @@ get-maintainers-for-packages *attrpaths: _packages_json
[[ "${#attrpaths[@]}" -gt 0 ]]
#grep </tmp/nixpkgs-maintainers.tsv -F "$(printf "%s\t\n" "${attrpaths[@]}")"
attrpath_json=$(printf "%s\n" "${attrpaths[@]}" | jq -sR 'split("\n")|map(select(.==""|not))' -c)
jq <packages.json --argjson attrs "$attrpath_json" '. as $pkgs | $attrs[] | $pkgs[.].meta.maintainers // [] | .[] | .github' -r | sort -u
$JQ_GOJQ <packages.json --argjson attrs "$attrpath_json" '. as $pkgs | $attrs[] | $pkgs[.].meta.maintainers // [] | .[] | .github' -r | sort -u
get-versions $attrpath=`just _a_package` *paths: setup