mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
`allowedReferences` and friends can, in addition to supporting store paths (and placeholders, but because those will be rewritten to store paths), they also support to refering to other outputs in the derivation by name. We update the tests in order to cover for that. (While we are at it, also introduce some scratch variables for paths and placeholders to make the C++ literalsf for this test more concise.)
82 lines
1.3 KiB
Nix
82 lines
1.3 KiB
Nix
{ contentAddress }:
|
|
|
|
let
|
|
caArgs =
|
|
if contentAddress then
|
|
{
|
|
__contentAddressed = true;
|
|
outputHashMode = "recursive";
|
|
outputHashAlgo = "sha256";
|
|
}
|
|
else
|
|
{ };
|
|
|
|
derivation' = args: derivation (caArgs // args);
|
|
|
|
system = "my-system";
|
|
|
|
foo = derivation' {
|
|
inherit system;
|
|
name = "foo";
|
|
builder = "/bin/bash";
|
|
args = [
|
|
"-c"
|
|
"echo foo > $out"
|
|
];
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
];
|
|
};
|
|
|
|
bar = derivation' {
|
|
inherit system;
|
|
name = "bar";
|
|
builder = "/bin/bash";
|
|
args = [
|
|
"-c"
|
|
"echo bar > $out"
|
|
];
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
];
|
|
};
|
|
|
|
in
|
|
derivation' {
|
|
inherit system;
|
|
name = "advanced-attributes";
|
|
builder = "/bin/bash";
|
|
args = [
|
|
"-c"
|
|
"echo hello > $out"
|
|
];
|
|
__sandboxProfile = "sandcastle";
|
|
__noChroot = true;
|
|
__impureHostDeps = [ "/usr/bin/ditto" ];
|
|
impureEnvVars = [ "UNICORN" ];
|
|
__darwinAllowLocalNetworking = true;
|
|
allowedReferences = [ foo ];
|
|
allowedRequisites = [
|
|
foo.dev
|
|
"bin"
|
|
];
|
|
disallowedReferences = [
|
|
bar
|
|
"dev"
|
|
];
|
|
disallowedRequisites = [ bar.dev ];
|
|
requiredSystemFeatures = [
|
|
"rainbow"
|
|
"uid-range"
|
|
];
|
|
preferLocalBuild = true;
|
|
allowSubstitutes = false;
|
|
exportReferencesGraph = [
|
|
"refs1"
|
|
foo
|
|
"refs2"
|
|
bar.drvPath
|
|
];
|
|
}
|