mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
Add testcase for nix develop
with __structuredAttrs
This commit is contained in:
parent
f1e281c4fe
commit
3504c811a5
5 changed files with 24 additions and 3 deletions
|
@ -8,6 +8,14 @@ let pkgs = rec {
|
|||
for pkg in $buildInputs; do
|
||||
export PATH=$PATH:$pkg/bin
|
||||
done
|
||||
|
||||
# mimic behavior of stdenv for `$out` etc. for structured attrs.
|
||||
if [ -n "''${ATTRS_SH_FILE}" ]; then
|
||||
for o in "''${!outputs[@]}"; do
|
||||
eval "''${o}=''${outputs[$o]}"
|
||||
export "''${o}"
|
||||
done
|
||||
fi
|
||||
'';
|
||||
|
||||
stdenv = mkDerivation {
|
||||
|
|
|
@ -6,10 +6,12 @@ let
|
|||
mkdir $out; echo bla > $out/bla
|
||||
'';
|
||||
};
|
||||
inherit (import ./shell.nix { inNixShell = true; }) stdenv;
|
||||
in
|
||||
mkDerivation {
|
||||
name = "structured2";
|
||||
__structuredAttrs = true;
|
||||
inherit stdenv;
|
||||
outputs = [ "out" "dev" ];
|
||||
my.list = [ "a" "b" "c" ];
|
||||
exportReferencesGraph.refs = [ dep ];
|
||||
|
|
|
@ -12,3 +12,8 @@ nix-build structured-attrs.nix -A all -o $TEST_ROOT/result
|
|||
export NIX_BUILD_SHELL=$SHELL
|
||||
env NIX_PATH=nixpkgs=shell.nix nix-shell structured-attrs-shell.nix \
|
||||
--run 'test -e .attrs.json; test "3" = "$(jq ".my.list|length" < $ATTRS_JSON_FILE)"'
|
||||
|
||||
# `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.
|
||||
nix develop -f structured-attrs-shell.nix -c bash -c 'test -n "$out"'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue