mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Functional test for derivation "advanced attrs"
This tests the Nix language side of things. We are purposely skipping most of `common.sh` because it is overkill for this test: we don't want to have an "overfit" test environment. Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
This commit is contained in:
parent
490ca93cf8
commit
9f9984e4d0
14 changed files with 155 additions and 11 deletions
|
@ -0,0 +1 @@
|
|||
Derive([("out","/nix/store/1qsc7svv43m4dw2prh6mvyf7cai5czji-advanced-attributes-defaults","","")],[],[],"my-system","/bin/bash",["-c","echo hello > $out"],[("builder","/bin/bash"),("name","advanced-attributes-defaults"),("out","/nix/store/1qsc7svv43m4dw2prh6mvyf7cai5czji-advanced-attributes-defaults"),("system","my-system")])
|
|
@ -0,0 +1,6 @@
|
|||
derivation {
|
||||
name = "advanced-attributes-defaults";
|
||||
system = "my-system";
|
||||
builder = "/bin/bash";
|
||||
args = [ "-c" "echo hello > $out" ];
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Derive([("dev","/nix/store/8bazivnbipbyi569623skw5zm91z6kc2-advanced-attributes-structured-attrs-defaults-dev","",""),("out","/nix/store/f8f8nvnx32bxvyxyx2ff7akbvwhwd9dw-advanced-attributes-structured-attrs-defaults","","")],[],[],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"builder\":\"/bin/bash\",\"name\":\"advanced-attributes-structured-attrs-defaults\",\"outputs\":[\"out\",\"dev\"],\"system\":\"my-system\"}"),("dev","/nix/store/8bazivnbipbyi569623skw5zm91z6kc2-advanced-attributes-structured-attrs-defaults-dev"),("out","/nix/store/f8f8nvnx32bxvyxyx2ff7akbvwhwd9dw-advanced-attributes-structured-attrs-defaults")])
|
|
@ -0,0 +1,8 @@
|
|||
derivation {
|
||||
name = "advanced-attributes-structured-attrs-defaults";
|
||||
system = "my-system";
|
||||
builder = "/bin/bash";
|
||||
args = [ "-c" "echo hello > $out" ];
|
||||
outputs = [ "out" "dev" ];
|
||||
__structuredAttrs = true;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Derive([("bin","/nix/store/pbzb48v0ycf80jgligcp4n8z0rblna4n-advanced-attributes-structured-attrs-bin","",""),("dev","/nix/store/7xapi8jv7flcz1qq8jhw55ar8ag8hldh-advanced-attributes-structured-attrs-dev","",""),("out","/nix/store/mpq3l1l1qc2yr50q520g08kprprwv79f-advanced-attributes-structured-attrs","","")],[("/nix/store/4xm4wccqsvagz9gjksn24s7rip2fdy7v-foo.drv",["out"]),("/nix/store/plsq5jbr5nhgqwcgb2qxw7jchc09dnl8-bar.drv",["out"])],[],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"__darwinAllowLocalNetworking\":true,\"__impureHostDeps\":[\"/usr/bin/ditto\"],\"__noChroot\":true,\"__sandboxProfile\":\"sandcastle\",\"allowSubstitutes\":false,\"builder\":\"/bin/bash\",\"impureEnvVars\":[\"UNICORN\"],\"name\":\"advanced-attributes-structured-attrs\",\"outputChecks\":{\"bin\":{\"disallowedReferences\":[\"/nix/store/7rhsm8i393hm1wcsmph782awg1hi2f7x-bar\"],\"disallowedRequisites\":[\"/nix/store/7rhsm8i393hm1wcsmph782awg1hi2f7x-bar\"]},\"dev\":{\"maxClosureSize\":5909,\"maxSize\":789},\"out\":{\"allowedReferences\":[\"/nix/store/3c08bzb71z4wiag719ipjxr277653ynp-foo\"],\"allowedRequisites\":[\"/nix/store/3c08bzb71z4wiag719ipjxr277653ynp-foo\"]}},\"outputs\":[\"out\",\"bin\",\"dev\"],\"preferLocalBuild\":true,\"requiredSystemFeatures\":[\"rainbow\",\"uid-range\"],\"system\":\"my-system\"}"),("bin","/nix/store/pbzb48v0ycf80jgligcp4n8z0rblna4n-advanced-attributes-structured-attrs-bin"),("dev","/nix/store/7xapi8jv7flcz1qq8jhw55ar8ag8hldh-advanced-attributes-structured-attrs-dev"),("out","/nix/store/mpq3l1l1qc2yr50q520g08kprprwv79f-advanced-attributes-structured-attrs")])
|
|
@ -0,0 +1,45 @@
|
|||
let
|
||||
system = "my-system";
|
||||
foo = derivation {
|
||||
inherit system;
|
||||
name = "foo";
|
||||
builder = "/bin/bash";
|
||||
args = ["-c" "echo foo > $out"];
|
||||
};
|
||||
bar = derivation {
|
||||
inherit system;
|
||||
name = "bar";
|
||||
builder = "/bin/bash";
|
||||
args = ["-c" "echo bar > $out"];
|
||||
};
|
||||
in
|
||||
derivation {
|
||||
inherit system;
|
||||
name = "advanced-attributes-structured-attrs";
|
||||
builder = "/bin/bash";
|
||||
args = [ "-c" "echo hello > $out" ];
|
||||
__sandboxProfile = "sandcastle";
|
||||
__noChroot = true;
|
||||
__impureHostDeps = ["/usr/bin/ditto"];
|
||||
impureEnvVars = ["UNICORN"];
|
||||
__darwinAllowLocalNetworking = true;
|
||||
outputs = [ "out" "bin" "dev" ];
|
||||
__structuredAttrs = true;
|
||||
outputChecks = {
|
||||
out = {
|
||||
allowedReferences = [foo];
|
||||
allowedRequisites = [foo];
|
||||
};
|
||||
bin = {
|
||||
disallowedReferences = [bar];
|
||||
disallowedRequisites = [bar];
|
||||
};
|
||||
dev = {
|
||||
maxSize = 789;
|
||||
maxClosureSize = 5909;
|
||||
};
|
||||
};
|
||||
requiredSystemFeatures = ["rainbow" "uid-range"];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
1
tests/functional/derivation/advanced-attributes.drv
Normal file
1
tests/functional/derivation/advanced-attributes.drv
Normal file
|
@ -0,0 +1 @@
|
|||
Derive([("out","/nix/store/33a6fdmn8q9ih9d7npbnrxn2q56a4l8q-advanced-attributes","","")],[("/nix/store/4xm4wccqsvagz9gjksn24s7rip2fdy7v-foo.drv",["out"]),("/nix/store/plsq5jbr5nhgqwcgb2qxw7jchc09dnl8-bar.drv",["out"])],[],"my-system","/bin/bash",["-c","echo hello > $out"],[("__darwinAllowLocalNetworking","1"),("__impureHostDeps","/usr/bin/ditto"),("__noChroot","1"),("__sandboxProfile","sandcastle"),("allowSubstitutes",""),("allowedReferences","/nix/store/3c08bzb71z4wiag719ipjxr277653ynp-foo"),("allowedRequisites","/nix/store/3c08bzb71z4wiag719ipjxr277653ynp-foo"),("builder","/bin/bash"),("disallowedReferences","/nix/store/7rhsm8i393hm1wcsmph782awg1hi2f7x-bar"),("disallowedRequisites","/nix/store/7rhsm8i393hm1wcsmph782awg1hi2f7x-bar"),("impureEnvVars","UNICORN"),("name","advanced-attributes"),("out","/nix/store/33a6fdmn8q9ih9d7npbnrxn2q56a4l8q-advanced-attributes"),("preferLocalBuild","1"),("requiredSystemFeatures","rainbow uid-range"),("system","my-system")])
|
33
tests/functional/derivation/advanced-attributes.nix
Normal file
33
tests/functional/derivation/advanced-attributes.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
let
|
||||
system = "my-system";
|
||||
foo = derivation {
|
||||
inherit system;
|
||||
name = "foo";
|
||||
builder = "/bin/bash";
|
||||
args = ["-c" "echo foo > $out"];
|
||||
};
|
||||
bar = derivation {
|
||||
inherit system;
|
||||
name = "bar";
|
||||
builder = "/bin/bash";
|
||||
args = ["-c" "echo bar > $out"];
|
||||
};
|
||||
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];
|
||||
disallowedReferences = [bar];
|
||||
disallowedRequisites = [bar];
|
||||
requiredSystemFeatures = ["rainbow" "uid-range"];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue