Skip to content

Commit d09f06a

Browse files
committed
fixup! tools: improve nix-changes coverage
1 parent 2029e3c commit d09f06a

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

tools/nix/list-requisites.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
set -ex
44

5-
OPTIONAL_FLAGS=$(nix-instantiate \
6-
--eval --strict --json -E '
7-
builtins.filter
8-
(n: builtins.match "with[A-Z].+" n != null)
9-
(builtins.attrNames (builtins.functionArgs (import ./shell.nix)))
10-
' | jq -r 'map("--arg \(.) true") | join(" ")')
5+
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
6+
7+
OPTIONAL_FLAGS=$(nix-instantiate -I "nixpkgs=$BASE_DIR/tools/nix/pkgs.nix" --eval --strict --raw -E "
8+
(import <nixpkgs> {}).lib.concatMapStrings
9+
(n: ''--arg \${n} true '')
10+
(builtins.filter
11+
(n: builtins.match ''with[A-Z].+'' n != null)
12+
(builtins.attrNames (builtins.functionArgs (import $BASE_DIR/shell.nix))))
13+
"
14+
)
1115

1216
DRV=$(
17+
cd "$BASE_DIR"
1318
# shellcheck disable=SC2086
1419
nix-instantiate -I "nixpkgs=./tools/nix/pkgs.nix" shell.nix \
1520
$OPTIONAL_FLAGS \
@@ -54,4 +59,4 @@ REFS=$(nix-store --query --references "$DRV")
5459
STORE_PATHS=$(echo "$REFS" | xargs nix-store --realise)
5560
REQUISITES=$(echo "$STORE_PATHS" | xargs nix-store --query --requisites)
5661

57-
echo "$REQUISITES" | sort -k1.45
62+
echo "$REQUISITES" | sort -k1.45 | uniq

0 commit comments

Comments
 (0)