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