From 3530908f16c908648580085ef5ba240775668e16 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 30 May 2025 20:12:45 +0200 Subject: [PATCH] ksdasdk --- justfile | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/justfile b/justfile index 6a78570..ee3fc21 100644 --- a/justfile +++ b/justfile @@ -71,9 +71,21 @@ 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-by-fname *fnames: + #!/usr/bin/env -S bash -euo pipefail + declare -a fnames=("$@") + if [[ "${#fnames[@]}" -gt 0 ]]; then + printf "%s\n" "${fnames[@]}" | just _list_packages_attrpath_filtered + elif [[ -t 0 ]]; then + fd . pkgs -enix -tf | fzf --reverse --multi | just _list_packages_attrpath_filtered + else + echo >&2 No args and no tty, reading from stdin... + just _list_packages_attrpath_filtered + fi + @_list_packages_attrpath_filtered: tr '0123456789' '9876543210' | sort -u | tr '0123456789' '9876543210' \ - | xargs -d $'\n' -n 2000 just __list_packages_attrpath_filtered + | xargs -d $'\n' -n 2000 --no-run-if-empty just __list_packages_attrpath_filtered __list_packages_attrpath_filtered +attrpaths: #!/usr/bin/env -S bash -euo pipefail declare -a attrpaths=("$@") @@ -273,9 +285,16 @@ __build_packages $system $outdir +$attrpaths: set -x # NIXPKGS_ALLOW_UNFREE=1 nix-build . -A "$attrpath" --system "$system" ${_JUST_NIX_INSTANTIATE_ARGS:-} -j0 --option builders "" --option substitute false -o "$dst" >&/dev/null if [[ -n "$drvpath" ]]; then + local inStoreDrvPath # eww, why doesn't the !output syntax work for out of store symlinks? + if [[ "$drvpath" =~ '!' ]]; then + inStoreDrvPath="$(realpath "$(cut -d! -f1 <<<"$drvpath")")!$(cut -d! -f2 <<<"$drvpath")" + else + inStoreDrvPath="$(realpath "$drvpath")" + fi # NIXPKGS_ALLOW_UNFREE=1 nix-build "$drvpath" -j0 --option builders "" --option substitute false --out-link "$dst" >&/dev/null # NIXPKGS_ALLOW_UNFREE=1 nix-build "$drvpath" -j0 --option builders "" --option substitute false --out-link "$gcroot" >&/dev/null - nix-build "$drvpath" -j0 --option builders "" --option substitute false --out-link "$gcroot" >&/dev/null ||: + #nix-build "$drvpath" -j0 --option builders "" --option substitute false --out-link "$gcroot" >&/dev/null ||: + nix-build "$inStoreDrvPath" -j0 --option builders "" --option substitute false --out-link "$gcroot" >&/dev/null ||: if [[ "$drvpath" =~ '!' ]]; then # :( gcroot="$gcroot-$(cut -d! -f2 <<<"$drvpath")" @@ -286,13 +305,13 @@ __build_packages $system $outdir +$attrpaths: fi # local outpaths=$( nix-store -q --outputs "$drvpath" ) # doesn't gcroot, some outputs may not be pulled from builders if [[ -L "$dst" ]]; then - nix log $(readlink "$dst") > "$dst".log 2>/dev/null ||: + nix log --option substituters "" $(readlink "$dst") > "$dst".log 2>/dev/null ||: else if [[ -z "$drvpath" ]]; then ln -s "$NOTFOUNDDIR"/no-eval "$dst" else ln -s /build-failure-"$attrpath" "$dst" - nix log ".#$attrpath" --system "$system" ${_JUST_NIX_INSTANTIATE_ARGS:-} > "$dst".log 2>/dev/null ||: + nix log --option substituters "" ".#$attrpath" --system "$system" ${_JUST_NIX_INSTANTIATE_ARGS:-} > "$dst".log 2>/dev/null ||: fi fi } @@ -303,6 +322,7 @@ __build_packages $system $outdir +$attrpaths: while [[ ! -f flake.nix ]]; do cd .. done + set -v _JUST_NIX_INSTANTIATE_ARGS="\$*" just __build_packages "\${1:-"$system"}" $(printf " %q" "$outdir" "${attrpaths[@]}") EOF chmod +x "$outdir"/_rerun.sh @@ -525,7 +545,6 @@ _fix +packages: then bat build.nix --style header-filename else cat build.nix fi - echo "./results/_rerun.sh --system $JUST_SYSTEM" pr $number=`just _a_pr`: #!/usr/bin/env -S bash -euo pipefail