From 506dec3a6ba8dd7a941c87522cf7df3eec9e62df Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 8 Apr 2025 03:10:06 +0200 Subject: [PATCH] jkasdjkdaskas --- justfile | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index fc9094f..0931d51 100644 --- a/justfile +++ b/justfile @@ -50,12 +50,34 @@ list-packages +$cut_args="-c1-": _packages_json | grep -v $'\t'pkgs/tools/package-management/akku/default.nix \ | grep -v $'\t'pkgs/tools/typesetting/tex/texlive/build-texlive-package.nix +@_list_packages_attrpath_filtered: + xargs -d $'\n' -n 2000 just __list_packages_attrpath_filtered +__list_packages_attrpath_filtered +attrpaths: + #!/usr/bin/env -S bash -euo pipefail + declare -a attrpaths=("$@") + attrpaths=("${attrpaths[@]/"."/"\."}") + attrpaths=("${attrpaths[@]/"*"/"\*"}") + attrpaths=("${attrpaths[@]/"+"/"\+"}") + attrpaths=("${attrpaths[@]/"$"/"\$"}") + attrpaths=("${attrpaths[@]/"("/"\("}") + attrpaths=("${attrpaths[@]/")"/"\)"}") + attrpaths=("${attrpaths[@]/#/"^"}") + attrpaths=("${attrpaths[@]/%/$'\t'}") + # printf >&1 "'%s'\n" "${attrpaths[@]}" + just list-packages | grep "$(printf "%s\n" "${attrpaths[@]}")" + [no-cd] @list-ripgrepped-packages +$ripgrep_args: - [[ -e .git && -e flake.nix ]] || { echo >&2 "ERROR; Not in repo root"; false; } - [[ -n "$ripgrep_args" ]] || { echo >&2 "ERROR; No ripgrep args"; false; } + [[ -e .git && -e flake.nix ]] || { echo >&2 "ERROR: Not in repo root"; false; } + [[ -n "$ripgrep_args" ]] || { echo >&2 "ERROR: No ripgrep args"; false; } rg "$@" pkgs/ -tnix -l | just _list_packages_fname_filtered +[no-cd] +@list-nix-located-packages +$nix_locate_args: + [[ -e .git && -e flake.nix ]] || { echo >&2 "ERROR: Not in repo root"; false; } + [[ -n "$nix_locate_args" ]] || { echo >&2 "ERROR: No nix-locate args"; false; } + nix-locate --top-level --regex "$@" | cut -d' ' -f1 | sd '\.out$' '' | sort -u | just _list_packages_attrpath_filtered + @list-dirty-packages: test -n "$($GIT diff HEAD --name-only)" || { echo >&2 "No unstaged dirty files found!"; false; } cd "$invokedir"; $GIT diff HEAD --name-only | just _list_packages_fname_filtered @@ -74,6 +96,10 @@ list-packages +$cut_args="-c1-": _packages_json [[ -n "$extra_args" ]] && export _JUST_NIX_INSTANTIATE_ARGS="$(shift; shift; printf " %q" "$@")"; \ cd "$invokedir"; just list-ripgrepped-packages "$ripgrep_arg" | cut -f1 | xargs printf "${attr_prefix//%/%%}"'%s'"${attr_suffix//%/%%} " | xargs just build-packages +@build-nix-located-packages $nix_locate_arg $attr_prefix="" $attr_suffix="" +$extra_args="": + [[ -n "$extra_args" ]] && export _JUST_NIX_INSTANTIATE_ARGS="$(shift; shift; printf " %q" "$@")"; \ + cd "$invokedir"; just list-nix-located-packages "$nix_locate_arg" | cut -f1 | xargs printf "${attr_prefix//%/%%}"'%s'"${attr_suffix//%/%%} " | xargs just build-packages + @build-dirty-packages $attr_prefix="" $attr_suffix="" +$extra_args="": [[ -n "$extra_args" ]] && export _JUST_NIX_INSTANTIATE_ARGS="$(shift; shift; printf " %q" "$@")"; \ cd "$invokedir"; just list-dirty-packages | cut -f1 | xargs printf "${attr_prefix//%/%%}"'%s'"${attr_suffix//%/%%} " | xargs just build-packages