mirror of
https://github.com/NixOS/nix.git
synced 2024-11-29 02:02:27 +00:00
9d2ed0a7d3
This should make `_NIX_TEST_ACCEPT=1` work again, fixing #11369. Progress on #2503
34 lines
899 B
Nix
34 lines
899 B
Nix
with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/dyn-drv/config.nix";
|
|
|
|
let innerName = "foo"; in
|
|
|
|
mkDerivation rec {
|
|
name = "${innerName}.drv";
|
|
SHELL = shell;
|
|
|
|
requiredSystemFeatures = [ "recursive-nix" ];
|
|
|
|
drv = builtins.unsafeDiscardOutputDependency (import ./text-hashed-output.nix).hello.drvPath;
|
|
|
|
buildCommand = ''
|
|
export NIX_CONFIG='experimental-features = nix-command ca-derivations'
|
|
|
|
PATH=${builtins.getEnv "EXTRA_PATH"}:$PATH
|
|
|
|
# JSON of pre-existing drv
|
|
nix derivation show $drv | jq .[] > drv0.json
|
|
|
|
# Fix name
|
|
jq < drv0.json '.name = "${innerName}"' > drv1.json
|
|
|
|
# Extend `buildCommand`
|
|
jq < drv1.json '.env.buildCommand += "echo \"I am alive!\" >> $out/hello\n"' > drv0.json
|
|
|
|
# Used as our output
|
|
cp $(nix derivation add < drv0.json) $out
|
|
'';
|
|
__contentAddressed = true;
|
|
outputHashMode = "text";
|
|
outputHashAlgo = "sha256";
|
|
}
|