diff --git a/justfile b/justfile index 8d0c66c..6c1fd4f 100644 --- a/justfile +++ b/justfile @@ -222,6 +222,15 @@ _instantiate_packages $system +$attrpaths: xe -j0 -s 'NIXPKGS_ALLOW_UNFREE=1 nix-instantiate . -A "$1" --system "$system" '"${_JUST_NIX_INSTANTIATE_ARGS:-}"'' fi +[no-cd] +profile *args: + #!/usr/bin/env -S bash -euo pipefail + declare -a args=("$@") + if [[ "${#args[@]}" -eq 0 ]]; then + args=(. -A "$(just _a_package)") + fi + set -x + NIX_SHOW_STATS=1 NIX_COUNT_CALLS=1 nix-instantiate "${args[@]}" # _JUST_NIX_BUILD_ARGS='--check' # _JUST_NIX_BUILD_ARGS='-j0 --builders "@/etc/nix/machines; ssh://pederbs@heid.idi.ntnu.no x86_64-linux - 24 5 big-parallel"' @@ -477,8 +486,8 @@ bump-here *packages: printf "%s.src\n" "${packages[@]}" | xargs just __build_packages "$system" results-src-new # TODO: unpack? just __build_packages "$system" results "${packages[@]}" # TODO: filter non-existing tests: - printf "%s.tests\n" "${packages[@]}" | env _JUST_NIX_BUILD_ARGS="-j1" xargs just __build_packages "$system" results-tests - printf "HEAD^%s " $(seq 0 $(($#-1))) | xe $GIT show + printf "%s.tests\n" "${packages[@]}" | env _JUST_NIX_BUILD_ARGS="-j1" xargs just __build_packages "$system" results-tests + printf "HEAD^%s " $(seq 0 $(( "${#packages[@]}" - 1 ))) | xe $GIT show fd . -l results results-tests --max-depth 1 # test -L result && fd . result --type x --color=always | tee update-executables.txt # $GIT show --name-only --pretty="" | xe statix fix @@ -486,6 +495,8 @@ bump-here *packages: printf "\n" printf "delta results-src-{old,new}/%s.src/.\n" "${packages[@]}" printf "\n" + printf > delta-cmds.sh "echo no; exit 1\n" + printf >>delta-cmds.sh "delta results-src-{old,new}/%s.src/.\n" "${packages[@]}" fix *packages: #!/usr/bin/env -S bash -euo pipefail @@ -886,47 +897,78 @@ open-package-urls $package=`just _a_package`: urls+=("https://search.nixos.org/packages?channel=unstable&query=${fpkg}") printf "%s\n" "" "${urls[@]}" | fzf --reverse --multi | { grep . ||:; } | xe xdg-open -enqueue-nixpkgs-review $pr=`just _a_pr`: +enqueue-nixpkgs-review *$prs: #!/usr/bin/env -S bash -euo pipefail if ! command -v pueue >/dev/null || ! pueue status >&/dev/null; then echo >&2 "ERROR: pueue not available!" exit 1 fi + + declare -a prs=("$@") + if [[ "${#prs[@]}" -eq 0 ]]; then + readarray -td $'\n' prs < <( just _some_prs ) + [[ "${#prs[@]}" -ne 0 ]] + fi declare -a all_systems=( x86_64-linux aarch64-linux aarch64-darwin x86_64-darwin ) declare -a systems=() readarray -td $'\n' systems < <( printf "%s\n" "${all_systems[@]}" | fzf --sync --layout=reverse --multi ) declare -a all_configs=( "" + "allowInsecurePredicate = x: true;" "cudaSupport = true;" "rocmSupport = true;" - "allowInsecurePredicate = x: true;" - # "allowUnfree = true;" # default + # "allowUnfree = true;" # default in nixpkgs-review "allowUnfree = false;" "allowBroken = true;" # "allowUnsupportedSystem = true;" ) declare -a configs=() readarray -td $'\n' "configs" < <( printf "%s\n" "${all_configs[@]}" | fzf --sync --layout=reverse --multi ) - declare -a nixpkgs_review_args=( - pr "$pr" - --no-shell - --post-result - --systems "${systems[*]}" - --extra-nixpkgs-config "{ ${configs[*]} }" - ) - # TODO: --checkout commit - # TODO: --eval local cd master - echo + pueue add nixpkgs-review "${nixpkgs_review_args[@]}" - if gum confirm; then - pueue add --escape nixpkgs-review "${nixpkgs_review_args[@]}" - fi + gum confirm + for pr in $prs; do + declare -a nixpkgs_review_args=( + pr "$pr" + --no-shell + --post-result + --systems "${systems[*]}" + --extra-nixpkgs-config "{ ${configs[*]} }" + ) + # TODO: --checkout commit + # TODO: --eval local + #echo + pueue add nixpkgs-review "${nixpkgs_review_args[@]}" + (set -x + pueue add --escape nixpkgs-review "${nixpkgs_review_args[@]}" + ) + done # === internal helpers === -# TODO: prefer using a packages.json in the invocationdir if it exists -# TODO: add an alternative recipie that makes it for the invocationdir worktree -# TODO: add a recipie that allows you to determine the rootdir of the invocationdir worktree +[no-cd] +mk-packages-json $fname="packages.json" $rootdir=`cd "$invokedir"; git rev-parse --show-toplevel` $outpaths=`gum confirm "Eval outpaths?" --default=no && echo true || echo false`: + #!/usr/bin/env -S bash -euo pipefail + extra_args=() + if [[ -n "$outpaths" && "$outpaths" != false ]]; then + extra_args+=(--drv-path --out-path) + fi + # keeping this in ram requires 220mb extra memory + packages_json="$( + set -x + time nix-env "$fname" + _packages_json: #!/usr/bin/env -S bash -euo pipefail echo| { # don't swallow stdin, TODO: can i do this with exec? @@ -937,17 +979,8 @@ _packages_json: if ! $GIT -C master/ diff HEAD --exit-code --quiet 1>&2; then echo >&2 "ERROR: $(realpath master) is dirty!" fi - git -C master/ pull upstream master 1>&2 - time nix-env > packages.json \ - --extra-experimental-features no-url-literals \ - --option system "$(just _this_system)" \ - -f ./master \ - -qaP \ - --json \ - --meta \ - --show-trace \ - --no-allow-import-from-derivation \ - --arg config '{ allowAliases = false; }' + git -C master/ pull upstream master --rebase --autostash 1>&2 + just mk-packages-json "packages.json" "./master" false fi }