1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 02:43:54 +02:00

Fix a few shellcheck tests

Ref nixos/nix#10795
This commit is contained in:
Bryan Honof 2024-08-02 00:10:08 +02:00
parent 612fc76020
commit cc9fe4dee7
No known key found for this signature in database
13 changed files with 102 additions and 106 deletions

View file

@ -8,17 +8,19 @@ requireDaemonNewerThan "2.4pre20210712"
clearStoreIfPossible
rm -f $TEST_ROOT/result
rm -f "$TEST_ROOT"/result
nix-build structured-attrs.nix -A all -o $TEST_ROOT/result
nix-build structured-attrs.nix -A all -o "$TEST_ROOT"/result
[[ $(cat $TEST_ROOT/result/foo) = bar ]]
[[ $(cat $TEST_ROOT/result-dev/foo) = foo ]]
[[ $(cat "$TEST_ROOT"/result/foo) = bar ]]
[[ $(cat "$TEST_ROOT"/result-dev/foo) = foo ]]
export NIX_BUILD_SHELL=$SHELL
# shellcheck disable=SC2016
env NIX_PATH=nixpkgs=shell.nix nix-shell structured-attrs-shell.nix \
--run 'test "3" = "$(jq ".my.list|length" < $NIX_ATTRS_JSON_FILE)"'
# shellcheck disable=SC2016
nix develop -f structured-attrs-shell.nix -c bash -c 'test "3" = "$(jq ".my.list|length" < $NIX_ATTRS_JSON_FILE)"'
TODO_NixOS # following line fails.
@ -26,6 +28,7 @@ TODO_NixOS # following line fails.
# `nix develop` is a slightly special way of dealing with environment vars, it parses
# these from a shell-file exported from a derivation. This is to test especially `outputs`
# (which is an associative array in thsi case) being fine.
# shellcheck disable=SC2016
nix develop -f structured-attrs-shell.nix -c bash -c 'test -n "$out"'
nix print-dev-env -f structured-attrs-shell.nix | grepQuiet 'NIX_ATTRS_JSON_FILE='