mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 21:46:01 +01:00
Merge pull request #12026 from Ma27/2.3-backport-structured-attrs-env
[2.3] build: backport NIX_ATTRS_*_FILE
This commit is contained in:
commit
ff8cce1244
2 changed files with 8 additions and 0 deletions
|
|
@ -2584,6 +2584,7 @@ void DerivationGoal::writeStructuredAttrs()
|
|||
|
||||
writeFile(tmpDir + "/.attrs.json", rewriteStrings(json.dump(), inputRewrites));
|
||||
chownToBuilder(tmpDir + "/.attrs.json");
|
||||
env["NIX_ATTRS_JSON_FILE"] = tmpDirInSandbox + "/.attrs.json";
|
||||
|
||||
/* As a convenience to bash scripts, write a shell file that
|
||||
maps all attributes that are representable in bash -
|
||||
|
|
@ -2653,6 +2654,7 @@ void DerivationGoal::writeStructuredAttrs()
|
|||
|
||||
writeFile(tmpDir + "/.attrs.sh", rewriteStrings(jsonSh, inputRewrites));
|
||||
chownToBuilder(tmpDir + "/.attrs.sh");
|
||||
env["NIX_ATTRS_SH_FILE"] = tmpDirInSandbox + "/.attrs.sh";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ mkDerivation {
|
|||
[[ $json =~ '"narSize":288' ]]
|
||||
[[ $json =~ '"closureSize":288' ]]
|
||||
[[ $json =~ '"references":[]' ]]
|
||||
|
||||
[[ -e "$NIX_ATTRS_SH_FILE" ]]
|
||||
[[ -e "$NIX_ATTRS_JSON_FILE" ]]
|
||||
|
||||
[[ "$(<"$NIX_ATTRS_SH_FILE")" = "$(<.attrs.sh)" ]]
|
||||
[[ "$(<"$NIX_ATTRS_JSON_FILE")" = "$(<.attrs.json)" ]]
|
||||
'';
|
||||
|
||||
buildInputs = [ "a" "b" "c" 123 "'" "\"" null ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue