change working directory

Did you know installables are parsed with regex? This mitigates how
horrifying that is.
This commit is contained in:
Charles Hall 2025-07-30 10:00:48 -07:00
parent be3822d585
commit 85b9080c77

View file

@ -2,8 +2,6 @@
set -euo pipefail set -euo pipefail
toplevel="$(git rev-parse --show-toplevel)"
# Build and cache the specified arguments # Build and cache the specified arguments
just() { just() {
if command -v nom &> /dev/null; then if command -v nom &> /dev/null; then
@ -17,7 +15,7 @@ just() {
return return
fi fi
nix run --inputs-from "$toplevel" attic -- \ nix run --inputs-from . attic -- \
login \ login \
"$ATTIC_SERVER" \ "$ATTIC_SERVER" \
"$ATTIC_ENDPOINT" \ "$ATTIC_ENDPOINT" \
@ -38,7 +36,7 @@ just() {
# store paths include a newline in them. # store paths include a newline in them.
( (
IFS=$'\n' IFS=$'\n'
nix shell --inputs-from "$toplevel" attic -c xargs \ nix shell --inputs-from . attic -c xargs \
attic push "$ATTIC_SERVER:$ATTIC_CACHE" <<< "${cache[*]}" attic push "$ATTIC_SERVER:$ATTIC_CACHE" <<< "${cache[*]}"
) )
} }
@ -46,10 +44,10 @@ just() {
# Build and cache things needed for CI # Build and cache things needed for CI
ci() { ci() {
cache=( cache=(
--inputs-from "$toplevel" --inputs-from .
# Keep sorted # Keep sorted
"$toplevel#devShells.x86_64-linux.default" ".#devShells.x86_64-linux.default"
attic#default attic#default
nixpkgs#direnv nixpkgs#direnv
nixpkgs#jq nixpkgs#jq
@ -63,12 +61,14 @@ ci() {
packages() { packages() {
readarray -t cache < <( readarray -t cache < <(
nix flake show --json 2> /dev/null | nix flake show --json 2> /dev/null |
nix run --inputs-from "$toplevel" nixpkgs#jq -- \ nix run --inputs-from . nixpkgs#jq -- \
-r \ -r \
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | .[]' '.packages."x86_64-linux" | keys | map(".#" + .) | .[]'
) )
just "${cache[@]}" just "${cache[@]}"
} }
pushd "$(git rev-parse --show-toplevel)" > /dev/null
"$@" "$@"
popd > /dev/null