mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Merge a9fdd537ac into 479b6b73a9
This commit is contained in:
commit
75615b45c0
48 changed files with 1248 additions and 342 deletions
|
|
@ -1653,6 +1653,8 @@ static void derivationStrictInternal(EvalState & state, std::string_view drvName
|
||||||
drv.structuredAttrs = std::move(*jsonObject);
|
drv.structuredAttrs = std::move(*jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drv.options = derivationOptionsFromStructuredAttrs(*state.store, drv.inputDrvs, drv.env, drv.structuredAttrs);
|
||||||
|
|
||||||
/* Everything in the context of the strings in the derivation
|
/* Everything in the context of the strings in the derivation
|
||||||
attributes should be added as dependencies of the resulting
|
attributes should be added as dependencies of the resulting
|
||||||
derivation. */
|
derivation. */
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,30 @@
|
||||||
"srcs": []
|
"srcs": []
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-defaults",
|
"name": "advanced-attributes-defaults",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"out": {
|
"out": {
|
||||||
"hashAlgo": "sha256",
|
"hashAlgo": "sha256",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,22 @@
|
||||||
"srcs": []
|
"srcs": []
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-structured-attrs-defaults",
|
"name": "advanced-attributes-structured-attrs-defaults",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"perOutput": {}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"dev": {
|
"dev": {
|
||||||
"hashAlgo": "sha256",
|
"hashAlgo": "sha256",
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,72 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-structured-attrs",
|
"name": "advanced-attributes-structured-attrs",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "sandcastle",
|
||||||
|
"allowLocalNetworking": true,
|
||||||
|
"allowSubstitutes": false,
|
||||||
|
"exportReferencesGraph": {
|
||||||
|
"refs1": [
|
||||||
|
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
||||||
|
],
|
||||||
|
"refs2": [
|
||||||
|
"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"impureEnvVars": [
|
||||||
|
"UNICORN"
|
||||||
|
],
|
||||||
|
"impureHostDeps": [
|
||||||
|
"/usr/bin/ditto"
|
||||||
|
],
|
||||||
|
"noChroot": true,
|
||||||
|
"outputChecks": {
|
||||||
|
"perOutput": {
|
||||||
|
"bin": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [
|
||||||
|
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"
|
||||||
|
],
|
||||||
|
"disallowedRequisites": [
|
||||||
|
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
||||||
|
],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": 5909,
|
||||||
|
"maxSize": 789
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"allowedReferences": [
|
||||||
|
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
||||||
|
],
|
||||||
|
"allowedRequisites": [
|
||||||
|
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"
|
||||||
|
],
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": true,
|
||||||
|
"requiredSystemFeatures": [
|
||||||
|
"rainbow",
|
||||||
|
"uid-range"
|
||||||
|
],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"bin": {
|
"bin": {
|
||||||
"hashAlgo": "sha256",
|
"hashAlgo": "sha256",
|
||||||
|
|
@ -69,7 +135,8 @@
|
||||||
"outputChecks": {
|
"outputChecks": {
|
||||||
"bin": {
|
"bin": {
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"
|
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g",
|
||||||
|
"dev"
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
||||||
|
|
@ -84,7 +151,8 @@
|
||||||
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"
|
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z",
|
||||||
|
"bin"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@
|
||||||
"__sandboxProfile": "sandcastle",
|
"__sandboxProfile": "sandcastle",
|
||||||
"allowSubstitutes": "",
|
"allowSubstitutes": "",
|
||||||
"allowedReferences": "/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9",
|
"allowedReferences": "/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9",
|
||||||
"allowedRequisites": "/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z",
|
"allowedRequisites": "/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z bin",
|
||||||
"builder": "/bin/bash",
|
"builder": "/bin/bash",
|
||||||
"disallowedReferences": "/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g",
|
"disallowedReferences": "/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g dev",
|
||||||
"disallowedRequisites": "/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8",
|
"disallowedRequisites": "/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8",
|
||||||
"exportReferencesGraph": "refs1 /164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9 refs2 /nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
"exportReferencesGraph": "refs1 /164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9 refs2 /nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
||||||
"impureEnvVars": "UNICORN",
|
"impureEnvVars": "UNICORN",
|
||||||
|
|
@ -47,6 +47,52 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes",
|
"name": "advanced-attributes",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "sandcastle",
|
||||||
|
"allowLocalNetworking": true,
|
||||||
|
"allowSubstitutes": false,
|
||||||
|
"exportReferencesGraph": {
|
||||||
|
"refs1": [
|
||||||
|
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
||||||
|
],
|
||||||
|
"refs2": [
|
||||||
|
"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"impureEnvVars": [
|
||||||
|
"UNICORN"
|
||||||
|
],
|
||||||
|
"impureHostDeps": [
|
||||||
|
"/usr/bin/ditto"
|
||||||
|
],
|
||||||
|
"noChroot": true,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": [
|
||||||
|
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
||||||
|
],
|
||||||
|
"allowedRequisites": [
|
||||||
|
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"
|
||||||
|
],
|
||||||
|
"disallowedReferences": [
|
||||||
|
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"
|
||||||
|
],
|
||||||
|
"disallowedRequisites": [
|
||||||
|
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
||||||
|
],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": true,
|
||||||
|
"requiredSystemFeatures": [
|
||||||
|
"rainbow",
|
||||||
|
"uid-range"
|
||||||
|
],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"out": {
|
"out": {
|
||||||
"hashAlgo": "sha256",
|
"hashAlgo": "sha256",
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
"allowSubstitutes": false,
|
"allowSubstitutes": false,
|
||||||
"exportReferencesGraph": {
|
"exportReferencesGraph": {
|
||||||
"refs1": [
|
"refs1": [
|
||||||
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"refs2": [
|
"refs2": [
|
||||||
"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
"qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"impureEnvVars": [
|
"impureEnvVars": [
|
||||||
|
|
@ -20,16 +23,36 @@
|
||||||
"outputChecks": {
|
"outputChecks": {
|
||||||
"forAllOutputs": {
|
"forAllOutputs": {
|
||||||
"allowedReferences": [
|
"allowedReferences": [
|
||||||
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "dev"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "dev"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"drvPath": "qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
{
|
||||||
|
"drvPath": "qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
||||||
|
"output": "dev"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"ignoreSelfRefs": true,
|
"ignoreSelfRefs": true,
|
||||||
"maxClosureSize": null,
|
"maxClosureSize": null,
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
"allowSubstitutes": false,
|
"allowSubstitutes": false,
|
||||||
"exportReferencesGraph": {
|
"exportReferencesGraph": {
|
||||||
"refs1": [
|
"refs1": [
|
||||||
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"refs2": [
|
"refs2": [
|
||||||
"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
"qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"impureEnvVars": [
|
"impureEnvVars": [
|
||||||
|
|
@ -23,10 +26,20 @@
|
||||||
"allowedReferences": null,
|
"allowedReferences": null,
|
||||||
"allowedRequisites": null,
|
"allowedRequisites": null,
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "dev"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"drvPath": "qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"
|
{
|
||||||
|
"drvPath": "qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",
|
||||||
|
"output": "dev"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"ignoreSelfRefs": false,
|
"ignoreSelfRefs": false,
|
||||||
"maxClosureSize": null,
|
"maxClosureSize": null,
|
||||||
|
|
@ -43,10 +56,20 @@
|
||||||
},
|
},
|
||||||
"out": {
|
"out": {
|
||||||
"allowedReferences": [
|
"allowedReferences": [
|
||||||
"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "out"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"drvPath": "j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",
|
||||||
|
"output": "dev"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"disallowedReferences": [],
|
"disallowedReferences": [],
|
||||||
"disallowedRequisites": [],
|
"disallowedRequisites": [],
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,30 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "dyn-dep-derivation",
|
"name": "dyn-dep-derivation",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {},
|
"outputs": {},
|
||||||
"system": "wasm-sel4",
|
"system": "wasm-sel4",
|
||||||
"version": 4
|
"version": 4
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,30 @@
|
||||||
"srcs": []
|
"srcs": []
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-defaults",
|
"name": "advanced-attributes-defaults",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"out": {
|
"out": {
|
||||||
"path": "1qsc7svv43m4dw2prh6mvyf7cai5czji-advanced-attributes-defaults"
|
"path": "1qsc7svv43m4dw2prh6mvyf7cai5czji-advanced-attributes-defaults"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,22 @@
|
||||||
"srcs": []
|
"srcs": []
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-structured-attrs-defaults",
|
"name": "advanced-attributes-structured-attrs-defaults",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"perOutput": {}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"dev": {
|
"dev": {
|
||||||
"path": "8bazivnbipbyi569623skw5zm91z6kc2-advanced-attributes-structured-attrs-defaults-dev"
|
"path": "8bazivnbipbyi569623skw5zm91z6kc2-advanced-attributes-structured-attrs-defaults-dev"
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
],
|
],
|
||||||
"builder": "/bin/bash",
|
"builder": "/bin/bash",
|
||||||
"env": {
|
"env": {
|
||||||
"bin": "/nix/store/33qms3h55wlaspzba3brlzlrm8m2239g-advanced-attributes-structured-attrs-bin",
|
"bin": "/nix/store/cnpasdljgkhnwaf78cf3qygcp4qbki1c-advanced-attributes-structured-attrs-bin",
|
||||||
"dev": "/nix/store/wyfgwsdi8rs851wmy1xfzdxy7y5vrg5l-advanced-attributes-structured-attrs-dev",
|
"dev": "/nix/store/ijq6mwpa9jbnpnl33qldfqihrr38kprx-advanced-attributes-structured-attrs-dev",
|
||||||
"out": "/nix/store/7cxy4zx1vqc885r4jl2l64pymqbdmhii-advanced-attributes-structured-attrs"
|
"out": "/nix/store/h1vh648d3p088kdimy0r8ngpfx7c3nzw-advanced-attributes-structured-attrs"
|
||||||
},
|
},
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"drvs": {
|
"drvs": {
|
||||||
|
|
@ -31,15 +31,81 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes-structured-attrs",
|
"name": "advanced-attributes-structured-attrs",
|
||||||
"outputs": {
|
"options": {
|
||||||
|
"additionalSandboxProfile": "sandcastle",
|
||||||
|
"allowLocalNetworking": true,
|
||||||
|
"allowSubstitutes": false,
|
||||||
|
"exportReferencesGraph": {
|
||||||
|
"refs1": [
|
||||||
|
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
|
],
|
||||||
|
"refs2": [
|
||||||
|
"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"impureEnvVars": [
|
||||||
|
"UNICORN"
|
||||||
|
],
|
||||||
|
"impureHostDeps": [
|
||||||
|
"/usr/bin/ditto"
|
||||||
|
],
|
||||||
|
"noChroot": true,
|
||||||
|
"outputChecks": {
|
||||||
|
"perOutput": {
|
||||||
"bin": {
|
"bin": {
|
||||||
"path": "33qms3h55wlaspzba3brlzlrm8m2239g-advanced-attributes-structured-attrs-bin"
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [
|
||||||
|
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
||||||
|
],
|
||||||
|
"disallowedRequisites": [
|
||||||
|
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
||||||
|
],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"path": "wyfgwsdi8rs851wmy1xfzdxy7y5vrg5l-advanced-attributes-structured-attrs-dev"
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": 5909,
|
||||||
|
"maxSize": 789
|
||||||
},
|
},
|
||||||
"out": {
|
"out": {
|
||||||
"path": "7cxy4zx1vqc885r4jl2l64pymqbdmhii-advanced-attributes-structured-attrs"
|
"allowedReferences": [
|
||||||
|
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
|
],
|
||||||
|
"allowedRequisites": [
|
||||||
|
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
||||||
|
],
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": false,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": true,
|
||||||
|
"requiredSystemFeatures": [
|
||||||
|
"rainbow",
|
||||||
|
"uid-range"
|
||||||
|
],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
|
"outputs": {
|
||||||
|
"bin": {
|
||||||
|
"path": "cnpasdljgkhnwaf78cf3qygcp4qbki1c-advanced-attributes-structured-attrs-bin"
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"path": "ijq6mwpa9jbnpnl33qldfqihrr38kprx-advanced-attributes-structured-attrs-dev"
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"path": "h1vh648d3p088kdimy0r8ngpfx7c3nzw-advanced-attributes-structured-attrs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"structuredAttrs": {
|
"structuredAttrs": {
|
||||||
|
|
@ -66,7 +132,8 @@
|
||||||
"outputChecks": {
|
"outputChecks": {
|
||||||
"bin": {
|
"bin": {
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar",
|
||||||
|
"dev"
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
||||||
|
|
@ -81,7 +148,8 @@
|
||||||
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev",
|
||||||
|
"bin"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@
|
||||||
"__sandboxProfile": "sandcastle",
|
"__sandboxProfile": "sandcastle",
|
||||||
"allowSubstitutes": "",
|
"allowSubstitutes": "",
|
||||||
"allowedReferences": "/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo",
|
"allowedReferences": "/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo",
|
||||||
"allowedRequisites": "/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev",
|
"allowedRequisites": "/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev bin",
|
||||||
"builder": "/bin/bash",
|
"builder": "/bin/bash",
|
||||||
"disallowedReferences": "/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar",
|
"disallowedReferences": "/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar dev",
|
||||||
"disallowedRequisites": "/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev",
|
"disallowedRequisites": "/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev",
|
||||||
"exportReferencesGraph": "refs1 /nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo refs2 /nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",
|
"exportReferencesGraph": "refs1 /nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo refs2 /nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",
|
||||||
"impureEnvVars": "UNICORN",
|
"impureEnvVars": "UNICORN",
|
||||||
"name": "advanced-attributes",
|
"name": "advanced-attributes",
|
||||||
"out": "/nix/store/wyhpwd748pns4k7svh48wdrc8kvjk0ra-advanced-attributes",
|
"out": "/nix/store/ymqmybkq5j4nd1xplw6ccdpbjnfi017v-advanced-attributes",
|
||||||
"preferLocalBuild": "1",
|
"preferLocalBuild": "1",
|
||||||
"requiredSystemFeatures": "rainbow uid-range",
|
"requiredSystemFeatures": "rainbow uid-range",
|
||||||
"system": "my-system"
|
"system": "my-system"
|
||||||
|
|
@ -45,9 +45,55 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "advanced-attributes",
|
"name": "advanced-attributes",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "sandcastle",
|
||||||
|
"allowLocalNetworking": true,
|
||||||
|
"allowSubstitutes": false,
|
||||||
|
"exportReferencesGraph": {
|
||||||
|
"refs1": [
|
||||||
|
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
|
],
|
||||||
|
"refs2": [
|
||||||
|
"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"impureEnvVars": [
|
||||||
|
"UNICORN"
|
||||||
|
],
|
||||||
|
"impureHostDeps": [
|
||||||
|
"/usr/bin/ditto"
|
||||||
|
],
|
||||||
|
"noChroot": true,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": [
|
||||||
|
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
|
],
|
||||||
|
"allowedRequisites": [
|
||||||
|
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
||||||
|
],
|
||||||
|
"disallowedReferences": [
|
||||||
|
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
||||||
|
],
|
||||||
|
"disallowedRequisites": [
|
||||||
|
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
||||||
|
],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": true,
|
||||||
|
"requiredSystemFeatures": [
|
||||||
|
"rainbow",
|
||||||
|
"uid-range"
|
||||||
|
],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"out": {
|
"out": {
|
||||||
"path": "wyhpwd748pns4k7svh48wdrc8kvjk0ra-advanced-attributes"
|
"path": "ymqmybkq5j4nd1xplw6ccdpbjnfi017v-advanced-attributes"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"system": "my-system",
|
"system": "my-system",
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
"allowSubstitutes": false,
|
"allowSubstitutes": false,
|
||||||
"exportReferencesGraph": {
|
"exportReferencesGraph": {
|
||||||
"refs1": [
|
"refs1": [
|
||||||
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
"p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
],
|
],
|
||||||
"refs2": [
|
"refs2": [
|
||||||
"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
"vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"impureEnvVars": [
|
"impureEnvVars": [
|
||||||
|
|
@ -20,16 +20,24 @@
|
||||||
"outputChecks": {
|
"outputChecks": {
|
||||||
"forAllOutputs": {
|
"forAllOutputs": {
|
||||||
"allowedReferences": [
|
"allowedReferences": [
|
||||||
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
"p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "bin"
|
||||||
|
},
|
||||||
|
"z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
||||||
],
|
],
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "dev"
|
||||||
|
},
|
||||||
|
"r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
"9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
||||||
],
|
],
|
||||||
"ignoreSelfRefs": true,
|
"ignoreSelfRefs": true,
|
||||||
"maxClosureSize": null,
|
"maxClosureSize": null,
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
"allowSubstitutes": false,
|
"allowSubstitutes": false,
|
||||||
"exportReferencesGraph": {
|
"exportReferencesGraph": {
|
||||||
"refs1": [
|
"refs1": [
|
||||||
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
"p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
],
|
],
|
||||||
"refs2": [
|
"refs2": [
|
||||||
"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
"vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"impureEnvVars": [
|
"impureEnvVars": [
|
||||||
|
|
@ -23,10 +23,14 @@
|
||||||
"allowedReferences": null,
|
"allowedReferences": null,
|
||||||
"allowedRequisites": null,
|
"allowedRequisites": null,
|
||||||
"disallowedReferences": [
|
"disallowedReferences": [
|
||||||
"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "dev"
|
||||||
|
},
|
||||||
|
"r5cff30838majxk5mp3ip2diffi8vpaj-bar"
|
||||||
],
|
],
|
||||||
"disallowedRequisites": [
|
"disallowedRequisites": [
|
||||||
"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
"9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"
|
||||||
],
|
],
|
||||||
"ignoreSelfRefs": false,
|
"ignoreSelfRefs": false,
|
||||||
"maxClosureSize": null,
|
"maxClosureSize": null,
|
||||||
|
|
@ -43,10 +47,14 @@
|
||||||
},
|
},
|
||||||
"out": {
|
"out": {
|
||||||
"allowedReferences": [
|
"allowedReferences": [
|
||||||
"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
"p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"
|
||||||
],
|
],
|
||||||
"allowedRequisites": [
|
"allowedRequisites": [
|
||||||
"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
{
|
||||||
|
"drvPath": "self",
|
||||||
|
"output": "bin"
|
||||||
|
},
|
||||||
|
"z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"
|
||||||
],
|
],
|
||||||
"disallowedReferences": [],
|
"disallowedReferences": [],
|
||||||
"disallowedRequisites": [],
|
"disallowedRequisites": [],
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,30 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"name": "simple-derivation",
|
"name": "simple-derivation",
|
||||||
|
"options": {
|
||||||
|
"additionalSandboxProfile": "",
|
||||||
|
"allowLocalNetworking": false,
|
||||||
|
"allowSubstitutes": true,
|
||||||
|
"exportReferencesGraph": {},
|
||||||
|
"impureEnvVars": [],
|
||||||
|
"impureHostDeps": [],
|
||||||
|
"noChroot": false,
|
||||||
|
"outputChecks": {
|
||||||
|
"forAllOutputs": {
|
||||||
|
"allowedReferences": null,
|
||||||
|
"allowedRequisites": null,
|
||||||
|
"disallowedReferences": [],
|
||||||
|
"disallowedRequisites": [],
|
||||||
|
"ignoreSelfRefs": true,
|
||||||
|
"maxClosureSize": null,
|
||||||
|
"maxSize": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"passAsFile": [],
|
||||||
|
"preferLocalBuild": false,
|
||||||
|
"requiredSystemFeatures": [],
|
||||||
|
"unsafeDiscardReferences": {}
|
||||||
|
},
|
||||||
"outputs": {},
|
"outputs": {},
|
||||||
"system": "wasm-sel4",
|
"system": "wasm-sel4",
|
||||||
"version": 4
|
"version": 4
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "nix/util/experimental-features.hh"
|
#include "nix/util/experimental-features.hh"
|
||||||
#include "nix/store/derivations.hh"
|
#include "nix/store/derivations.hh"
|
||||||
#include "nix/store/derivations.hh"
|
#include "nix/store/derived-path.hh"
|
||||||
#include "nix/store/derivation-options.hh"
|
#include "nix/store/derivation-options.hh"
|
||||||
#include "nix/store/parsed-derivations.hh"
|
#include "nix/store/parsed-derivations.hh"
|
||||||
#include "nix/util/types.hh"
|
#include "nix/util/types.hh"
|
||||||
|
|
@ -17,7 +17,7 @@ namespace nix {
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
|
|
||||||
class DerivationAdvancedAttrsTest : public JsonCharacterizationTest<Derivation>,
|
class DerivationAdvancedAttrsTest : public JsonCharacterizationTest<Derivation>,
|
||||||
public JsonCharacterizationTest<DerivationOptions>,
|
public JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>,
|
||||||
public LibStoreTest
|
public LibStoreTest
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -42,7 +42,8 @@ public:
|
||||||
{
|
{
|
||||||
this->readTest(fileName, [&](auto encoded) {
|
this->readTest(fileName, [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
auto options = derivationOptionsFromStructuredAttrs(
|
||||||
|
*this->store, got.inputDrvs, got.env, got.structuredAttrs, true, this->mockXpSettings);
|
||||||
EXPECT_EQ(options.getRequiredSystemFeatures(got), expectedFeatures);
|
EXPECT_EQ(options.getRequiredSystemFeatures(got), expectedFeatures);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -51,11 +52,14 @@ public:
|
||||||
* Helper function to test DerivationOptions parsing and comparison
|
* Helper function to test DerivationOptions parsing and comparison
|
||||||
*/
|
*/
|
||||||
void testDerivationOptions(
|
void testDerivationOptions(
|
||||||
const std::string & fileName, const DerivationOptions & expected, const StringSet & expectedSystemFeatures)
|
const std::string & fileName,
|
||||||
|
const DerivationOptions<SingleDerivedPath> & expected,
|
||||||
|
const StringSet & expectedSystemFeatures)
|
||||||
{
|
{
|
||||||
this->readTest(fileName, [&](auto encoded) {
|
this->readTest(fileName, [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
auto options = derivationOptionsFromStructuredAttrs(
|
||||||
|
*this->store, got.inputDrvs, got.env, got.structuredAttrs, true, this->mockXpSettings);
|
||||||
|
|
||||||
EXPECT_EQ(options, expected);
|
EXPECT_EQ(options, expected);
|
||||||
EXPECT_EQ(options.getRequiredSystemFeatures(got), expectedSystemFeatures);
|
EXPECT_EQ(options.getRequiredSystemFeatures(got), expectedSystemFeatures);
|
||||||
|
|
@ -127,11 +131,42 @@ TEST_ATERM_JSON(advancedAttributes_structuredAttrs_defaults, "advanced-attribute
|
||||||
|
|
||||||
#undef TEST_ATERM_JSON
|
#undef TEST_ATERM_JSON
|
||||||
|
|
||||||
using ExportReferencesMap = decltype(DerivationOptions::exportReferencesGraph);
|
/**
|
||||||
|
* Since these are both repeated and sensative opaque values, it makes
|
||||||
|
* sense to give them names in this file.
|
||||||
|
*/
|
||||||
|
static SingleDerivedPath
|
||||||
|
pathFoo = SingleDerivedPath::Opaque{StorePath{"p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"}},
|
||||||
|
pathFooDev = SingleDerivedPath::Opaque{StorePath{"z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"}},
|
||||||
|
pathBar = SingleDerivedPath::Opaque{StorePath{"r5cff30838majxk5mp3ip2diffi8vpaj-bar"}},
|
||||||
|
pathBarDev = SingleDerivedPath::Opaque{StorePath{"9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"}},
|
||||||
|
pathBarDrvIA = SingleDerivedPath::Opaque{StorePath{"vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"}},
|
||||||
|
pathBarDrvCA = SingleDerivedPath::Opaque{StorePath{"qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"}},
|
||||||
|
placeholderFoo =
|
||||||
|
SingleDerivedPath::Built{
|
||||||
|
.drvPath = makeConstantStorePathRef(StorePath{"j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv"}),
|
||||||
|
.output = "out",
|
||||||
|
},
|
||||||
|
placeholderFooDev =
|
||||||
|
SingleDerivedPath::Built{
|
||||||
|
.drvPath = makeConstantStorePathRef(StorePath{"j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv"}),
|
||||||
|
.output = "dev",
|
||||||
|
},
|
||||||
|
placeholderBar =
|
||||||
|
SingleDerivedPath::Built{
|
||||||
|
.drvPath = makeConstantStorePathRef(StorePath{"qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"}),
|
||||||
|
.output = "out",
|
||||||
|
},
|
||||||
|
placeholderBarDev = SingleDerivedPath::Built{
|
||||||
|
.drvPath = makeConstantStorePathRef(StorePath{"qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"}),
|
||||||
|
.output = "dev",
|
||||||
|
};
|
||||||
|
|
||||||
static const DerivationOptions advancedAttributes_defaults = {
|
using ExportReferencesMap = decltype(DerivationOptions<SingleDerivedPath>::exportReferencesGraph);
|
||||||
|
|
||||||
|
static const DerivationOptions<SingleDerivedPath> advancedAttributes_defaults = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.ignoreSelfRefs = true,
|
.ignoreSelfRefs = true,
|
||||||
},
|
},
|
||||||
.unsafeDiscardReferences = {},
|
.unsafeDiscardReferences = {},
|
||||||
|
|
@ -152,16 +187,14 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_defaults)
|
||||||
this->readTest("advanced-attributes-defaults.drv", [&](auto encoded) {
|
this->readTest("advanced-attributes-defaults.drv", [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
|
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
|
||||||
|
|
||||||
EXPECT_TRUE(!got.structuredAttrs);
|
EXPECT_TRUE(!got.structuredAttrs);
|
||||||
|
|
||||||
EXPECT_EQ(options, advancedAttributes_defaults);
|
EXPECT_EQ(got.options, advancedAttributes_defaults);
|
||||||
|
|
||||||
EXPECT_EQ(options.canBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.canBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.willBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.willBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.substitutesAllowed(), true);
|
EXPECT_EQ(got.options.substitutesAllowed(), true);
|
||||||
EXPECT_EQ(options.useUidRange(got), false);
|
EXPECT_EQ(got.options.useUidRange(got), false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -177,9 +210,9 @@ TEST_F(CaDerivationAdvancedAttrsTest, advancedAttributes_defaults)
|
||||||
|
|
||||||
TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes)
|
TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes)
|
||||||
{
|
{
|
||||||
DerivationOptions expected = {
|
DerivationOptions<SingleDerivedPath> expected = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.ignoreSelfRefs = true,
|
.ignoreSelfRefs = true,
|
||||||
},
|
},
|
||||||
.unsafeDiscardReferences = {},
|
.unsafeDiscardReferences = {},
|
||||||
|
|
@ -197,35 +230,33 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes)
|
||||||
this->readTest("advanced-attributes.drv", [&](auto encoded) {
|
this->readTest("advanced-attributes.drv", [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
|
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
|
||||||
|
|
||||||
EXPECT_TRUE(!got.structuredAttrs);
|
EXPECT_TRUE(!got.structuredAttrs);
|
||||||
|
|
||||||
// Reset fields that vary between test cases to enable whole-object comparison
|
// Reset fields that vary between test cases to enable whole-object comparison
|
||||||
options.outputChecks = DerivationOptions::OutputChecks{.ignoreSelfRefs = true};
|
got.options.outputChecks = DerivationOptions<SingleDerivedPath>::OutputChecks{.ignoreSelfRefs = true};
|
||||||
options.exportReferencesGraph = {};
|
got.options.exportReferencesGraph = {};
|
||||||
|
|
||||||
EXPECT_EQ(options, expected);
|
EXPECT_EQ(got.options, expected);
|
||||||
|
|
||||||
EXPECT_EQ(options.substitutesAllowed(), false);
|
EXPECT_EQ(got.options.substitutesAllowed(), false);
|
||||||
EXPECT_EQ(options.useUidRange(got), true);
|
EXPECT_EQ(got.options.useUidRange(got), true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
DerivationOptions advancedAttributes_ia = {
|
DerivationOptions<SingleDerivedPath> advancedAttributes_ia = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.ignoreSelfRefs = true,
|
.ignoreSelfRefs = true,
|
||||||
.allowedReferences = StringSet{"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"},
|
.allowedReferences = std::set<DrvRef<SingleDerivedPath>>{pathFoo},
|
||||||
.disallowedReferences = StringSet{"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"},
|
.disallowedReferences = std::set<DrvRef<SingleDerivedPath>>{pathBar, OutputName{"dev"}},
|
||||||
.allowedRequisites = StringSet{"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"},
|
.allowedRequisites = std::set<DrvRef<SingleDerivedPath>>{pathFooDev, OutputName{"bin"}},
|
||||||
.disallowedRequisites = StringSet{"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"},
|
.disallowedRequisites = std::set<DrvRef<SingleDerivedPath>>{pathBarDev},
|
||||||
},
|
},
|
||||||
.unsafeDiscardReferences = {},
|
.unsafeDiscardReferences = {},
|
||||||
.passAsFile = {},
|
.passAsFile = {},
|
||||||
.exportReferencesGraph{
|
.exportReferencesGraph{
|
||||||
{"refs1", {"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"}},
|
{"refs1", {pathFoo}},
|
||||||
{"refs2", {"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"}},
|
{"refs2", {pathBarDrvIA}},
|
||||||
},
|
},
|
||||||
.additionalSandboxProfile = "sandcastle",
|
.additionalSandboxProfile = "sandcastle",
|
||||||
.noChroot = true,
|
.noChroot = true,
|
||||||
|
|
@ -242,20 +273,20 @@ TEST_F(DerivationAdvancedAttrsTest, advancedAttributes_ia)
|
||||||
testDerivationOptions("advanced-attributes.drv", advancedAttributes_ia, {"rainbow", "uid-range"});
|
testDerivationOptions("advanced-attributes.drv", advancedAttributes_ia, {"rainbow", "uid-range"});
|
||||||
};
|
};
|
||||||
|
|
||||||
DerivationOptions advancedAttributes_ca = {
|
DerivationOptions<SingleDerivedPath> advancedAttributes_ca = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.ignoreSelfRefs = true,
|
.ignoreSelfRefs = true,
|
||||||
.allowedReferences = StringSet{"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"},
|
.allowedReferences = std::set<DrvRef<SingleDerivedPath>>{placeholderFoo},
|
||||||
.disallowedReferences = StringSet{"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"},
|
.disallowedReferences = std::set<DrvRef<SingleDerivedPath>>{placeholderBar, OutputName{"dev"}},
|
||||||
.allowedRequisites = StringSet{"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"},
|
.allowedRequisites = std::set<DrvRef<SingleDerivedPath>>{placeholderFooDev, OutputName{"bin"}},
|
||||||
.disallowedRequisites = StringSet{"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"},
|
.disallowedRequisites = std::set<DrvRef<SingleDerivedPath>>{placeholderBarDev},
|
||||||
},
|
},
|
||||||
.unsafeDiscardReferences = {},
|
.unsafeDiscardReferences = {},
|
||||||
.passAsFile = {},
|
.passAsFile = {},
|
||||||
.exportReferencesGraph{
|
.exportReferencesGraph{
|
||||||
{"refs1", {"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"}},
|
{"refs1", {placeholderFoo}},
|
||||||
{"refs2", {"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"}},
|
{"refs2", {pathBarDrvCA}},
|
||||||
},
|
},
|
||||||
.additionalSandboxProfile = "sandcastle",
|
.additionalSandboxProfile = "sandcastle",
|
||||||
.noChroot = true,
|
.noChroot = true,
|
||||||
|
|
@ -272,8 +303,8 @@ TEST_F(CaDerivationAdvancedAttrsTest, advancedAttributes)
|
||||||
testDerivationOptions("advanced-attributes.drv", advancedAttributes_ca, {"rainbow", "uid-range", "ca-derivations"});
|
testDerivationOptions("advanced-attributes.drv", advancedAttributes_ca, {"rainbow", "uid-range", "ca-derivations"});
|
||||||
};
|
};
|
||||||
|
|
||||||
DerivationOptions advancedAttributes_structuredAttrs_defaults = {
|
DerivationOptions<SingleDerivedPath> advancedAttributes_structuredAttrs_defaults = {
|
||||||
.outputChecks = std::map<std::string, DerivationOptions::OutputChecks>{},
|
.outputChecks = std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks>{},
|
||||||
.unsafeDiscardReferences = {},
|
.unsafeDiscardReferences = {},
|
||||||
.passAsFile = {},
|
.passAsFile = {},
|
||||||
.exportReferencesGraph = {},
|
.exportReferencesGraph = {},
|
||||||
|
|
@ -292,16 +323,17 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs_d
|
||||||
this->readTest("advanced-attributes-structured-attrs-defaults.drv", [&](auto encoded) {
|
this->readTest("advanced-attributes-structured-attrs-defaults.drv", [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
|
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
auto options = derivationOptionsFromStructuredAttrs(
|
||||||
|
*this->store, got.inputDrvs, got.env, got.structuredAttrs, true, this->mockXpSettings);
|
||||||
|
|
||||||
EXPECT_TRUE(got.structuredAttrs);
|
EXPECT_TRUE(got.structuredAttrs);
|
||||||
|
|
||||||
EXPECT_EQ(options, advancedAttributes_structuredAttrs_defaults);
|
EXPECT_EQ(got.options, advancedAttributes_structuredAttrs_defaults);
|
||||||
|
|
||||||
EXPECT_EQ(options.canBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.canBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.willBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.willBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.substitutesAllowed(), true);
|
EXPECT_EQ(got.options.substitutesAllowed(), true);
|
||||||
EXPECT_EQ(options.useUidRange(got), false);
|
EXPECT_EQ(got.options.useUidRange(got), false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -317,11 +349,11 @@ TEST_F(CaDerivationAdvancedAttrsTest, advancedAttributes_structuredAttrs_default
|
||||||
|
|
||||||
TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs)
|
TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs)
|
||||||
{
|
{
|
||||||
DerivationOptions expected = {
|
DerivationOptions<SingleDerivedPath> expected = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
std::map<std::string, DerivationOptions::OutputChecks>{
|
std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks>{
|
||||||
{"dev",
|
{"dev",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.maxSize = 789,
|
.maxSize = 789,
|
||||||
.maxClosureSize = 5909,
|
.maxClosureSize = 5909,
|
||||||
}},
|
}},
|
||||||
|
|
@ -342,15 +374,14 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs)
|
||||||
this->readTest("advanced-attributes-structured-attrs.drv", [&](auto encoded) {
|
this->readTest("advanced-attributes-structured-attrs.drv", [&](auto encoded) {
|
||||||
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
auto got = parseDerivation(*this->store, std::move(encoded), "foo", this->mockXpSettings);
|
||||||
|
|
||||||
DerivationOptions options = DerivationOptions::fromStructuredAttrs(got.env, got.structuredAttrs);
|
|
||||||
|
|
||||||
EXPECT_TRUE(got.structuredAttrs);
|
EXPECT_TRUE(got.structuredAttrs);
|
||||||
|
|
||||||
// Reset fields that vary between test cases to enable whole-object comparison
|
// Reset fields that vary between test cases to enable whole-object comparison
|
||||||
{
|
{
|
||||||
// Delete all keys but "dev" in options.outputChecks
|
// Delete all keys but "dev" in options.outputChecks
|
||||||
auto * outputChecksMapP =
|
auto * outputChecksMapP =
|
||||||
std::get_if<std::map<std::string, DerivationOptions::OutputChecks>>(&options.outputChecks);
|
std::get_if<std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks>>(
|
||||||
|
&got.options.outputChecks);
|
||||||
ASSERT_TRUE(outputChecksMapP);
|
ASSERT_TRUE(outputChecksMapP);
|
||||||
auto & outputChecksMap = *outputChecksMapP;
|
auto & outputChecksMap = *outputChecksMapP;
|
||||||
auto devEntry = outputChecksMap.find("dev");
|
auto devEntry = outputChecksMap.find("dev");
|
||||||
|
|
@ -359,32 +390,32 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs)
|
||||||
outputChecksMap.clear();
|
outputChecksMap.clear();
|
||||||
outputChecksMap.emplace("dev", std::move(devChecks));
|
outputChecksMap.emplace("dev", std::move(devChecks));
|
||||||
}
|
}
|
||||||
options.exportReferencesGraph = {};
|
got.options.exportReferencesGraph = {};
|
||||||
|
|
||||||
EXPECT_EQ(options, expected);
|
EXPECT_EQ(got.options, expected);
|
||||||
|
|
||||||
EXPECT_EQ(options.canBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.canBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.willBuildLocally(*this->store, got), false);
|
EXPECT_EQ(got.options.willBuildLocally(*this->store, got), false);
|
||||||
EXPECT_EQ(options.substitutesAllowed(), false);
|
EXPECT_EQ(got.options.substitutesAllowed(), false);
|
||||||
EXPECT_EQ(options.useUidRange(got), true);
|
EXPECT_EQ(got.options.useUidRange(got), true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
DerivationOptions advancedAttributes_structuredAttrs_ia = {
|
DerivationOptions<SingleDerivedPath> advancedAttributes_structuredAttrs_ia = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
std::map<std::string, DerivationOptions::OutputChecks>{
|
std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks>{
|
||||||
{"out",
|
{"out",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.allowedReferences = StringSet{"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"},
|
.allowedReferences = std::set<DrvRef<SingleDerivedPath>>{pathFoo},
|
||||||
.allowedRequisites = StringSet{"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"},
|
.allowedRequisites = std::set<DrvRef<SingleDerivedPath>>{pathFooDev, OutputName{"bin"}},
|
||||||
}},
|
}},
|
||||||
{"bin",
|
{"bin",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.disallowedReferences = StringSet{"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"},
|
.disallowedReferences = std::set<DrvRef<SingleDerivedPath>>{pathBar, OutputName{"dev"}},
|
||||||
.disallowedRequisites = StringSet{"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"},
|
.disallowedRequisites = std::set<DrvRef<SingleDerivedPath>>{pathBarDev},
|
||||||
}},
|
}},
|
||||||
{"dev",
|
{"dev",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.maxSize = 789,
|
.maxSize = 789,
|
||||||
.maxClosureSize = 5909,
|
.maxClosureSize = 5909,
|
||||||
}},
|
}},
|
||||||
|
|
@ -393,8 +424,8 @@ DerivationOptions advancedAttributes_structuredAttrs_ia = {
|
||||||
.passAsFile = {},
|
.passAsFile = {},
|
||||||
.exportReferencesGraph =
|
.exportReferencesGraph =
|
||||||
{
|
{
|
||||||
{"refs1", {"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"}},
|
{"refs1", {pathFoo}},
|
||||||
{"refs2", {"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"}},
|
{"refs2", {pathBarDrvIA}},
|
||||||
},
|
},
|
||||||
.additionalSandboxProfile = "sandcastle",
|
.additionalSandboxProfile = "sandcastle",
|
||||||
.noChroot = true,
|
.noChroot = true,
|
||||||
|
|
@ -412,21 +443,21 @@ TEST_F(DerivationAdvancedAttrsTest, advancedAttributes_structuredAttrs)
|
||||||
"advanced-attributes-structured-attrs.drv", advancedAttributes_structuredAttrs_ia, {"rainbow", "uid-range"});
|
"advanced-attributes-structured-attrs.drv", advancedAttributes_structuredAttrs_ia, {"rainbow", "uid-range"});
|
||||||
};
|
};
|
||||||
|
|
||||||
DerivationOptions advancedAttributes_structuredAttrs_ca = {
|
DerivationOptions<SingleDerivedPath> advancedAttributes_structuredAttrs_ca = {
|
||||||
.outputChecks =
|
.outputChecks =
|
||||||
std::map<std::string, DerivationOptions::OutputChecks>{
|
std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks>{
|
||||||
{"out",
|
{"out",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.allowedReferences = StringSet{"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"},
|
.allowedReferences = std::set<DrvRef<SingleDerivedPath>>{placeholderFoo},
|
||||||
.allowedRequisites = StringSet{"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"},
|
.allowedRequisites = std::set<DrvRef<SingleDerivedPath>>{placeholderFooDev, OutputName{"bin"}},
|
||||||
}},
|
}},
|
||||||
{"bin",
|
{"bin",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.disallowedReferences = StringSet{"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"},
|
.disallowedReferences = std::set<DrvRef<SingleDerivedPath>>{placeholderBar, OutputName{"dev"}},
|
||||||
.disallowedRequisites = StringSet{"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"},
|
.disallowedRequisites = std::set<DrvRef<SingleDerivedPath>>{placeholderBarDev},
|
||||||
}},
|
}},
|
||||||
{"dev",
|
{"dev",
|
||||||
DerivationOptions::OutputChecks{
|
DerivationOptions<SingleDerivedPath>::OutputChecks{
|
||||||
.maxSize = 789,
|
.maxSize = 789,
|
||||||
.maxClosureSize = 5909,
|
.maxClosureSize = 5909,
|
||||||
}},
|
}},
|
||||||
|
|
@ -435,8 +466,8 @@ DerivationOptions advancedAttributes_structuredAttrs_ca = {
|
||||||
.passAsFile = {},
|
.passAsFile = {},
|
||||||
.exportReferencesGraph =
|
.exportReferencesGraph =
|
||||||
{
|
{
|
||||||
{"refs1", {"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"}},
|
{"refs1", {placeholderFoo}},
|
||||||
{"refs2", {"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"}},
|
{"refs2", {pathBarDrvCA}},
|
||||||
},
|
},
|
||||||
.additionalSandboxProfile = "sandcastle",
|
.additionalSandboxProfile = "sandcastle",
|
||||||
.noChroot = true,
|
.noChroot = true,
|
||||||
|
|
@ -459,11 +490,13 @@ TEST_F(CaDerivationAdvancedAttrsTest, advancedAttributes_structuredAttrs)
|
||||||
#define TEST_JSON_OPTIONS(FIXUTURE, VAR, VAR2) \
|
#define TEST_JSON_OPTIONS(FIXUTURE, VAR, VAR2) \
|
||||||
TEST_F(FIXUTURE, DerivationOptions_##VAR##_from_json) \
|
TEST_F(FIXUTURE, DerivationOptions_##VAR##_from_json) \
|
||||||
{ \
|
{ \
|
||||||
this->JsonCharacterizationTest<DerivationOptions>::readJsonTest(#VAR, advancedAttributes_##VAR2); \
|
this->JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>::readJsonTest( \
|
||||||
|
#VAR, advancedAttributes_##VAR2); \
|
||||||
} \
|
} \
|
||||||
TEST_F(FIXUTURE, DerivationOptions_##VAR##_to_json) \
|
TEST_F(FIXUTURE, DerivationOptions_##VAR##_to_json) \
|
||||||
{ \
|
{ \
|
||||||
this->JsonCharacterizationTest<DerivationOptions>::writeJsonTest(#VAR, advancedAttributes_##VAR2); \
|
this->JsonCharacterizationTest<DerivationOptions<SingleDerivedPath>>::writeJsonTest( \
|
||||||
|
#VAR, advancedAttributes_##VAR2); \
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_JSON_OPTIONS(DerivationAdvancedAttrsTest, defaults, defaults)
|
TEST_JSON_OPTIONS(DerivationAdvancedAttrsTest, defaults, defaults)
|
||||||
|
|
@ -475,4 +508,56 @@ TEST_JSON_OPTIONS(CaDerivationAdvancedAttrsTest, structuredAttrs_all_set, struct
|
||||||
|
|
||||||
#undef TEST_JSON_OPTIONS
|
#undef TEST_JSON_OPTIONS
|
||||||
|
|
||||||
|
#define SYNC_CONFLICT(NAME, VALUE) \
|
||||||
|
NAME = VALUE; \
|
||||||
|
EXPECT_THROW(got.unparse(*store, false), Error); \
|
||||||
|
got.options = options;
|
||||||
|
|
||||||
|
TEST_F(DerivationAdvancedAttrsTest, Derivation_advancedAttributes_option_syncConflict)
|
||||||
|
{
|
||||||
|
readTest("advanced-attributes-defaults.drv", [&](auto encoded) {
|
||||||
|
auto got = parseDerivation(*store, std::move(encoded), "foo");
|
||||||
|
auto options = got.options;
|
||||||
|
|
||||||
|
SYNC_CONFLICT(got.options.additionalSandboxProfile, "foobar");
|
||||||
|
SYNC_CONFLICT(got.options.noChroot, true);
|
||||||
|
SYNC_CONFLICT(got.options.impureHostDeps, StringSet{"/usr/bin/ditto"});
|
||||||
|
SYNC_CONFLICT(got.options.impureEnvVars, StringSet{"HELLO"});
|
||||||
|
SYNC_CONFLICT(got.options.allowLocalNetworking, true);
|
||||||
|
SYNC_CONFLICT(std::get<0>(got.options.outputChecks).allowedReferences, StringSet{"nothing"});
|
||||||
|
SYNC_CONFLICT(std::get<0>(got.options.outputChecks).allowedRequisites, StringSet{"hey"});
|
||||||
|
SYNC_CONFLICT(std::get<0>(got.options.outputChecks).disallowedReferences, StringSet{"BAR"});
|
||||||
|
SYNC_CONFLICT(std::get<0>(got.options.outputChecks).disallowedRequisites, StringSet{"FOO"});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef SYNC_CONFLICT
|
||||||
|
|
||||||
|
#define SYNC_CONFLICT(NAME, VALUE) \
|
||||||
|
got.env[NAME] = VALUE; \
|
||||||
|
EXPECT_THROW(got.unparse(*store, false), Error); \
|
||||||
|
got.env = env;
|
||||||
|
|
||||||
|
TEST_F(DerivationAdvancedAttrsTest, Derivation_advancedAttributes_env_syncConflict)
|
||||||
|
{
|
||||||
|
readTest("advanced-attributes-defaults.drv", [&](auto encoded) {
|
||||||
|
auto got = parseDerivation(*store, std::move(encoded), "foo");
|
||||||
|
auto env = got.env;
|
||||||
|
|
||||||
|
// TODO: Is there any way to serialize a boolean/StringSet into an env value (string)?
|
||||||
|
// Something like `State::coerceToString`
|
||||||
|
SYNC_CONFLICT("__sandboxProfile", "foobar");
|
||||||
|
SYNC_CONFLICT("__noChroot", "1");
|
||||||
|
SYNC_CONFLICT("__impureHostDeps", "/usr/bin/ditto");
|
||||||
|
SYNC_CONFLICT("impureEnvVars", "FOOBAR");
|
||||||
|
SYNC_CONFLICT("__darwinAllowLocalNetworking", "1");
|
||||||
|
SYNC_CONFLICT("allowedReferences", "nothing");
|
||||||
|
SYNC_CONFLICT("allowedRequisites", "hey");
|
||||||
|
SYNC_CONFLICT("disallowedReferences", "BAR");
|
||||||
|
SYNC_CONFLICT("disallowedRequisites", "FOO");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef SYNC_CONFLICT
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,8 @@ Derivation makeSimpleDrv()
|
||||||
"WOLF",
|
"WOLF",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
drv.options =
|
||||||
|
derivationOptionsFromStructuredAttrs(StoreDirConfig{"/nix/store"}, drv.inputDrvs, drv.env, drv.structuredAttrs);
|
||||||
return drv;
|
return drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,6 +323,8 @@ Derivation makeDynDepDerivation()
|
||||||
"WOLF",
|
"WOLF",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
drv.options =
|
||||||
|
derivationOptionsFromStructuredAttrs(StoreDirConfig{"/nix/store"}, drv.inputDrvs, drv.env, drv.structuredAttrs);
|
||||||
return drv;
|
return drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ static Derivation makeSimpleDrv()
|
||||||
TEST_F(WriteDerivationTest, addToStoreFromDumpCalledOnce)
|
TEST_F(WriteDerivationTest, addToStoreFromDumpCalledOnce)
|
||||||
{
|
{
|
||||||
auto drv = makeSimpleDrv();
|
auto drv = makeSimpleDrv();
|
||||||
|
drv.options =
|
||||||
|
derivationOptionsFromStructuredAttrs(StoreDirConfig{"/nix/store"}, drv.inputDrvs, drv.env, drv.structuredAttrs);
|
||||||
|
|
||||||
auto path1 = writeDerivation(*store, drv, NoRepair);
|
auto path1 = writeDerivation(*store, drv, NoRepair);
|
||||||
config->readOnly = true;
|
config->readOnly = true;
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,19 @@ DerivationBuildingGoal::DerivationBuildingGoal(
|
||||||
, drv{std::make_unique<Derivation>(drv)}
|
, drv{std::make_unique<Derivation>(drv)}
|
||||||
, buildMode(buildMode)
|
, buildMode(buildMode)
|
||||||
{
|
{
|
||||||
|
auto x = tryResolve(
|
||||||
|
drv.options,
|
||||||
|
[&](ref<const SingleDerivedPath> drvPath, const std::string & outputName) -> std::optional<StorePath> {
|
||||||
try {
|
try {
|
||||||
drvOptions =
|
return resolveDerivedPath(
|
||||||
std::make_unique<DerivationOptions>(DerivationOptions::fromStructuredAttrs(drv.env, drv.structuredAttrs));
|
worker.store, SingleDerivedPath::Built{drvPath, outputName}, &worker.evalStore);
|
||||||
} catch (Error & e) {
|
} catch (Error &) {
|
||||||
e.addTrace({}, "while parsing derivation '%s'", worker.store.printStorePath(drvPath));
|
return std::nullopt;
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(x);
|
||||||
|
drvOptions = std::make_unique<DerivationOptions<StorePath>>(*x);
|
||||||
|
|
||||||
name = fmt("building derivation '%s'", worker.store.printStorePath(drvPath));
|
name = fmt("building derivation '%s'", worker.store.printStorePath(drvPath));
|
||||||
trace("created");
|
trace("created");
|
||||||
|
|
@ -344,7 +350,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||||
/* Don't do a remote build if the derivation has the attribute
|
/* Don't do a remote build if the derivation has the attribute
|
||||||
`preferLocalBuild' set. Also, check and repair modes are only
|
`preferLocalBuild' set. Also, check and repair modes are only
|
||||||
supported for local builds. */
|
supported for local builds. */
|
||||||
bool buildLocally = (buildMode != bmNormal || drvOptions->willBuildLocally(worker.store, *drv))
|
bool buildLocally = (buildMode != bmNormal || drv->options.willBuildLocally(worker.store, *drv))
|
||||||
&& settings.maxBuildJobs.get() != 0;
|
&& settings.maxBuildJobs.get() != 0;
|
||||||
|
|
||||||
if (buildLocally) {
|
if (buildLocally) {
|
||||||
|
|
@ -379,7 +385,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||||
|
|
||||||
externalBuilder = settings.findExternalDerivationBuilderIfSupported(*drv);
|
externalBuilder = settings.findExternalDerivationBuilderIfSupported(*drv);
|
||||||
|
|
||||||
if (!externalBuilder && !drvOptions->canBuildLocally(worker.store, *drv)) {
|
if (!externalBuilder && !drv->options.canBuildLocally(worker.store, *drv)) {
|
||||||
auto msg =
|
auto msg =
|
||||||
fmt("Cannot build '%s'.\n"
|
fmt("Cannot build '%s'.\n"
|
||||||
"Reason: " ANSI_RED "required system or feature not available" ANSI_NORMAL
|
"Reason: " ANSI_RED "required system or feature not available" ANSI_NORMAL
|
||||||
|
|
@ -388,7 +394,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||||
"Current system: '%s' with features {%s}",
|
"Current system: '%s' with features {%s}",
|
||||||
Magenta(worker.store.printStorePath(drvPath)),
|
Magenta(worker.store.printStorePath(drvPath)),
|
||||||
Magenta(drv->platform),
|
Magenta(drv->platform),
|
||||||
concatStringsSep(", ", drvOptions->getRequiredSystemFeatures(*drv)),
|
concatStringsSep(", ", drv->options.getRequiredSystemFeatures(*drv)),
|
||||||
Magenta(settings.thisSystem),
|
Magenta(settings.thisSystem),
|
||||||
concatStringsSep<StringSet>(", ", worker.store.Store::config.systemFeatures));
|
concatStringsSep<StringSet>(", ", worker.store.Store::config.systemFeatures));
|
||||||
|
|
||||||
|
|
@ -820,7 +826,7 @@ HookReply DerivationBuildingGoal::tryBuildHook(const std::map<std::string, Initi
|
||||||
|
|
||||||
/* Send the request to the hook. */
|
/* Send the request to the hook. */
|
||||||
worker.hook->sink << "try" << (worker.getNrLocalBuilds() < settings.maxBuildJobs ? 1 : 0) << drv->platform
|
worker.hook->sink << "try" << (worker.getNrLocalBuilds() < settings.maxBuildJobs ? 1 : 0) << drv->platform
|
||||||
<< worker.store.printStorePath(drvPath) << drvOptions->getRequiredSystemFeatures(*drv);
|
<< worker.store.printStorePath(drvPath) << drv->options.getRequiredSystemFeatures(*drv);
|
||||||
worker.hook->sink.flush();
|
worker.hook->sink.flush();
|
||||||
|
|
||||||
/* Read the first line of input, which should be a word indicating
|
/* Read the first line of input, which should be a word indicating
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ void checkOutputs(
|
||||||
Store & store,
|
Store & store,
|
||||||
const StorePath & drvPath,
|
const StorePath & drvPath,
|
||||||
const decltype(Derivation::outputs) & drvOutputs,
|
const decltype(Derivation::outputs) & drvOutputs,
|
||||||
const decltype(DerivationOptions::outputChecks) & outputChecks,
|
const decltype(DerivationOptions<StorePath>::outputChecks) & outputChecks,
|
||||||
const std::map<std::string, ValidPathInfo> & outputs)
|
const std::map<std::string, ValidPathInfo> & outputs)
|
||||||
{
|
{
|
||||||
std::map<Path, const ValidPathInfo &> outputsByPath;
|
std::map<Path, const ValidPathInfo &> outputsByPath;
|
||||||
|
|
@ -85,7 +85,7 @@ void checkOutputs(
|
||||||
return std::make_pair(std::move(pathsDone), closureSize);
|
return std::make_pair(std::move(pathsDone), closureSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto applyChecks = [&](const DerivationOptions::OutputChecks & checks) {
|
auto applyChecks = [&](const DerivationOptions<StorePath>::OutputChecks & checks) {
|
||||||
if (checks.maxSize && info.narSize > *checks.maxSize)
|
if (checks.maxSize && info.narSize > *checks.maxSize)
|
||||||
throw BuildError(
|
throw BuildError(
|
||||||
BuildResult::Failure::OutputRejected,
|
BuildResult::Failure::OutputRejected,
|
||||||
|
|
@ -105,28 +105,33 @@ void checkOutputs(
|
||||||
*checks.maxClosureSize);
|
*checks.maxClosureSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto checkRefs = [&](const StringSet & value, bool allowed, bool recursive) {
|
auto checkRefs = [&](const std::set<DrvRef<StorePath>> & value, bool allowed, bool recursive) {
|
||||||
/* Parse a list of reference specifiers. Each element must
|
/* Parse a list of reference specifiers. Each element must
|
||||||
either be a store path, or the symbolic name of the output
|
either be a store path, or the symbolic name of the output
|
||||||
of the derivation (such as `out'). */
|
of the derivation (such as `out'). */
|
||||||
StorePathSet spec;
|
StorePathSet spec;
|
||||||
for (auto & i : value) {
|
for (auto & i : value) {
|
||||||
if (store.isStorePath(i))
|
std::visit(
|
||||||
spec.insert(store.parseStorePath(i));
|
overloaded{
|
||||||
else if (auto output = get(outputs, i))
|
[&](const StorePath & path) { spec.insert(path); },
|
||||||
|
[&](const OutputName & refOutputName) {
|
||||||
|
if (auto output = get(outputs, refOutputName))
|
||||||
spec.insert(output->path);
|
spec.insert(output->path);
|
||||||
else {
|
else {
|
||||||
std::string outputsListing =
|
std::string outputsListing =
|
||||||
concatMapStringsSep(", ", outputs, [](auto & o) { return o.first; });
|
concatMapStringsSep(", ", outputs, [](auto & o) { return o.first; });
|
||||||
throw BuildError(
|
throw BuildError(
|
||||||
BuildResult::Failure::OutputRejected,
|
BuildResult::Failure::OutputRejected,
|
||||||
"derivation '%s' output check for '%s' contains an illegal reference specifier '%s',"
|
"derivation '%s' output check for '%s' contains output name '%s',"
|
||||||
" expected store path or output name (one of [%s])",
|
" but this is not a valid output of this derivation."
|
||||||
|
" (Valid outputs are [%s].)",
|
||||||
store.printStorePath(drvPath),
|
store.printStorePath(drvPath),
|
||||||
outputName,
|
outputName,
|
||||||
i,
|
refOutputName,
|
||||||
outputsListing);
|
outputsListing);
|
||||||
}
|
}
|
||||||
|
}},
|
||||||
|
i);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto used = recursive ? getClosure(info.path).first : info.references;
|
auto used = recursive ? getClosure(info.path).first : info.references;
|
||||||
|
|
@ -180,8 +185,8 @@ void checkOutputs(
|
||||||
|
|
||||||
std::visit(
|
std::visit(
|
||||||
overloaded{
|
overloaded{
|
||||||
[&](const DerivationOptions::OutputChecks & checks) { applyChecks(checks); },
|
[&](const DerivationOptions<StorePath>::OutputChecks & checks) { applyChecks(checks); },
|
||||||
[&](const std::map<std::string, DerivationOptions::OutputChecks> & checksPerOutput) {
|
[&](const std::map<std::string, DerivationOptions<StorePath>::OutputChecks> & checksPerOutput) {
|
||||||
if (auto outputChecks = get(checksPerOutput, outputName))
|
if (auto outputChecks = get(checksPerOutput, outputName))
|
||||||
|
|
||||||
applyChecks(*outputChecks);
|
applyChecks(*outputChecks);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ void checkOutputs(
|
||||||
Store & store,
|
Store & store,
|
||||||
const StorePath & drvPath,
|
const StorePath & drvPath,
|
||||||
const decltype(Derivation::outputs) & drvOutputs,
|
const decltype(Derivation::outputs) & drvOutputs,
|
||||||
const decltype(DerivationOptions::outputChecks) & drvOptions,
|
const decltype(DerivationOptions<StorePath>::outputChecks) & drvOptions,
|
||||||
const std::map<std::string, ValidPathInfo> & outputs);
|
const std::map<std::string, ValidPathInfo> & outputs);
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@ std::string & DesugaredEnv::atFileEnvPair(std::string_view name, std::string fil
|
||||||
}
|
}
|
||||||
|
|
||||||
DesugaredEnv DesugaredEnv::create(
|
DesugaredEnv DesugaredEnv::create(
|
||||||
Store & store, const Derivation & drv, const DerivationOptions & drvOptions, const StorePathSet & inputPaths)
|
Store & store,
|
||||||
|
const Derivation & drv,
|
||||||
|
const DerivationOptions<StorePath> & drvOptions,
|
||||||
|
const StorePathSet & inputPaths)
|
||||||
{
|
{
|
||||||
DesugaredEnv res;
|
DesugaredEnv res;
|
||||||
|
|
||||||
|
|
@ -46,7 +49,7 @@ DesugaredEnv DesugaredEnv::create(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle exportReferencesGraph(), if set. */
|
/* Handle exportReferencesGraph(), if set. */
|
||||||
for (auto & [fileName, storePaths] : drvOptions.getParsedExportReferencesGraph(store)) {
|
for (auto & [fileName, storePaths] : drvOptions.exportReferencesGraph) {
|
||||||
/* Write closure info to <fileName>. */
|
/* Write closure info to <fileName>. */
|
||||||
res.extraFiles.insert_or_assign(
|
res.extraFiles.insert_or_assign(
|
||||||
fileName, store.makeValidityRegistration(store.exportReferences(storePaths, inputPaths), false, false));
|
fileName, store.makeValidityRegistration(store.exportReferences(storePaths, inputPaths), false, false));
|
||||||
|
|
|
||||||
|
|
@ -64,15 +64,6 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
|
||||||
{
|
{
|
||||||
trace("have derivation");
|
trace("have derivation");
|
||||||
|
|
||||||
auto drvOptions = [&]() -> DerivationOptions {
|
|
||||||
try {
|
|
||||||
return DerivationOptions::fromStructuredAttrs(drv->env, drv->structuredAttrs);
|
|
||||||
} catch (Error & e) {
|
|
||||||
e.addTrace({}, "while parsing derivation '%s'", worker.store.printStorePath(drvPath));
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
if (!drv->type().hasKnownOutputPaths())
|
if (!drv->type().hasKnownOutputPaths())
|
||||||
experimentalFeatureSettings.require(Xp::CaDerivations);
|
experimentalFeatureSettings.require(Xp::CaDerivations);
|
||||||
|
|
||||||
|
|
@ -98,7 +89,7 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
|
||||||
/* We are first going to try to create the invalid output paths
|
/* We are first going to try to create the invalid output paths
|
||||||
through substitutes. If that doesn't work, we'll build
|
through substitutes. If that doesn't work, we'll build
|
||||||
them. */
|
them. */
|
||||||
if (settings.useSubstitutes && drvOptions.substitutesAllowed()) {
|
if (settings.useSubstitutes && drv->options.substitutesAllowed()) {
|
||||||
if (!checkResult)
|
if (!checkResult)
|
||||||
waitees.insert(upcast_goal(worker.makeDrvOutputSubstitutionGoal(DrvOutput{outputHash, wantedOutput})));
|
waitees.insert(upcast_goal(worker.makeDrvOutputSubstitutionGoal(DrvOutput{outputHash, wantedOutput})));
|
||||||
else {
|
else {
|
||||||
|
|
@ -151,7 +142,7 @@ Goal::Co DerivationGoal::haveDerivation(bool storeDerivation)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolutionGoal->resolvedDrv) {
|
if (resolutionGoal->resolvedDrv) {
|
||||||
auto & [pathResolved, drvResolved] = *resolutionGoal->resolvedDrv;
|
auto & [pathResolved, drvResolved, drvOptionsResolved] = *resolutionGoal->resolvedDrv;
|
||||||
|
|
||||||
auto resolvedDrvGoal =
|
auto resolvedDrvGoal =
|
||||||
worker.makeDerivationGoal(pathResolved, drvResolved, wantedOutput, buildMode, /*storeDerivation=*/true);
|
worker.makeDerivationGoal(pathResolved, drvResolved, wantedOutput, buildMode, /*storeDerivation=*/true);
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,8 @@ Goal::Co DerivationResolutionGoal::resolveDerivation()
|
||||||
}
|
}
|
||||||
assert(attempt);
|
assert(attempt);
|
||||||
|
|
||||||
auto pathResolved = writeDerivation(worker.store, *attempt, NoRepair, /*readOnly =*/true);
|
// TODO check options compatibility with ATerm.
|
||||||
|
auto pathResolved = writeDerivation(worker.store, attempt->first, NoRepair, /*readOnly =*/true);
|
||||||
|
|
||||||
auto msg =
|
auto msg =
|
||||||
fmt("resolved derivation: '%s' -> '%s'",
|
fmt("resolved derivation: '%s' -> '%s'",
|
||||||
|
|
@ -180,8 +181,8 @@ Goal::Co DerivationResolutionGoal::resolveDerivation()
|
||||||
worker.store.printStorePath(pathResolved),
|
worker.store.printStorePath(pathResolved),
|
||||||
});
|
});
|
||||||
|
|
||||||
resolvedDrv =
|
resolvedDrv = std::make_unique<std::tuple<StorePath, BasicDerivation, DerivationOptions<StorePath>>>(
|
||||||
std::make_unique<std::pair<StorePath, BasicDerivation>>(std::move(pathResolved), *std::move(attempt));
|
std::move(pathResolved), std::move(attempt->first), std::move(attempt->second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,18 @@
|
||||||
#include "nix/util/json-utils.hh"
|
#include "nix/util/json-utils.hh"
|
||||||
#include "nix/store/parsed-derivations.hh"
|
#include "nix/store/parsed-derivations.hh"
|
||||||
#include "nix/store/derivations.hh"
|
#include "nix/store/derivations.hh"
|
||||||
|
#include "nix/store/derived-path.hh"
|
||||||
#include "nix/store/store-api.hh"
|
#include "nix/store/store-api.hh"
|
||||||
#include "nix/util/types.hh"
|
#include "nix/util/types.hh"
|
||||||
#include "nix/util/util.hh"
|
#include "nix/util/util.hh"
|
||||||
#include "nix/store/globals.hh"
|
#include "nix/store/globals.hh"
|
||||||
|
#include "nix/util/variant-wrapper.hh"
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
@ -90,14 +93,60 @@ getStringSetAttr(const StringMap & env, const StructuredAttrs * parsed, const st
|
||||||
return ss ? (std::optional{StringSet{ss->begin(), ss->end()}}) : (std::optional<StringSet>{});
|
return ss ? (std::optional{StringSet{ss->begin(), ss->end()}}) : (std::optional<StringSet>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
using OutputChecks = DerivationOptions::OutputChecks;
|
template<typename Inputs>
|
||||||
|
using OutputChecks = DerivationOptions<Inputs>::OutputChecks;
|
||||||
|
|
||||||
using OutputChecksVariant = std::variant<OutputChecks, std::map<std::string, OutputChecks>>;
|
template<typename Inputs>
|
||||||
|
using OutputChecksVariant = std::variant<OutputChecks<Inputs>, std::map<std::string, OutputChecks<Inputs>>>;
|
||||||
|
|
||||||
DerivationOptions DerivationOptions::fromStructuredAttrs(
|
DerivationOptions<StorePath> derivationOptionsFromStructuredAttrs(
|
||||||
const StringMap & env, const std::optional<StructuredAttrs> & parsed, bool shouldWarn)
|
const StoreDirConfig & store,
|
||||||
|
const StringMap & env,
|
||||||
|
const StructuredAttrs * parsed,
|
||||||
|
bool shouldWarn,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings)
|
||||||
{
|
{
|
||||||
return fromStructuredAttrs(env, parsed ? &*parsed : nullptr);
|
/* Use the SingleDerivedPath version with empty inputDrvs, then
|
||||||
|
resolve. */
|
||||||
|
DerivedPathMap<StringSet> emptyInputDrvs{};
|
||||||
|
auto singleDerivedPathOptions =
|
||||||
|
derivationOptionsFromStructuredAttrs(store, emptyInputDrvs, env, parsed, shouldWarn, mockXpSettings);
|
||||||
|
|
||||||
|
/* "Resolve" all SingleDerivedPath inputs to StorePath. */
|
||||||
|
auto resolved = tryResolve(
|
||||||
|
singleDerivedPathOptions,
|
||||||
|
[&](ref<const SingleDerivedPath> drvPath, const std::string & outputName) -> std::optional<StorePath> {
|
||||||
|
// there should be nothing to resolve
|
||||||
|
assert(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Since we should never need to call the call back, there should be
|
||||||
|
no way it fails. */
|
||||||
|
assert(resolved);
|
||||||
|
|
||||||
|
return *resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
DerivationOptions<StorePath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const StringMap & env,
|
||||||
|
const std::optional<StructuredAttrs> & parsed,
|
||||||
|
bool shouldWarn,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings)
|
||||||
|
{
|
||||||
|
return derivationOptionsFromStructuredAttrs(store, env, parsed ? &*parsed : nullptr, shouldWarn, mockXpSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
DerivationOptions<SingleDerivedPath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const DerivedPathMap<StringSet> & inputDrvs,
|
||||||
|
const StringMap & env,
|
||||||
|
const std::optional<StructuredAttrs> & parsed,
|
||||||
|
bool shouldWarn,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings)
|
||||||
|
{
|
||||||
|
return derivationOptionsFromStructuredAttrs(
|
||||||
|
store, inputDrvs, env, parsed ? &*parsed : nullptr, shouldWarn, mockXpSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flatten(const nlohmann::json & value, StringSet & res)
|
static void flatten(const nlohmann::json & value, StringSet & res)
|
||||||
|
|
@ -111,10 +160,63 @@ static void flatten(const nlohmann::json & value, StringSet & res)
|
||||||
throw Error("'exportReferencesGraph' value is not an array or a string");
|
throw Error("'exportReferencesGraph' value is not an array or a string");
|
||||||
}
|
}
|
||||||
|
|
||||||
DerivationOptions
|
DerivationOptions<SingleDerivedPath> derivationOptionsFromStructuredAttrs(
|
||||||
DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAttrs * parsed, bool shouldWarn)
|
const StoreDirConfig & store,
|
||||||
|
const DerivedPathMap<StringSet> & inputDrvs,
|
||||||
|
const StringMap & env,
|
||||||
|
const StructuredAttrs * parsed,
|
||||||
|
bool shouldWarn,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings)
|
||||||
{
|
{
|
||||||
DerivationOptions defaults = {};
|
DerivationOptions<SingleDerivedPath> defaults = {};
|
||||||
|
|
||||||
|
std::map<std::string, SingleDerivedPath::Built> placeholders;
|
||||||
|
if (mockXpSettings.isEnabled(Xp::CaDerivations)) {
|
||||||
|
/* Initialize placeholder map from inputDrvs */
|
||||||
|
auto initPlaceholders = [&](this const auto & initPlaceholders,
|
||||||
|
ref<const SingleDerivedPath> basePath,
|
||||||
|
const DerivedPathMap<StringSet>::ChildNode & node) -> void {
|
||||||
|
for (const auto & outputName : node.value) {
|
||||||
|
auto built = SingleDerivedPath::Built{
|
||||||
|
.drvPath = basePath,
|
||||||
|
.output = outputName,
|
||||||
|
};
|
||||||
|
placeholders.insert_or_assign(
|
||||||
|
DownstreamPlaceholder::fromSingleDerivedPathBuilt(built, mockXpSettings).render(),
|
||||||
|
std::move(built));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto & [outputName, childNode] : node.childMap) {
|
||||||
|
initPlaceholders(
|
||||||
|
make_ref<const SingleDerivedPath>(SingleDerivedPath::Built{
|
||||||
|
.drvPath = basePath,
|
||||||
|
.output = outputName,
|
||||||
|
}),
|
||||||
|
childNode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const auto & [drvPath, outputs] : inputDrvs.map) {
|
||||||
|
auto basePath = make_ref<const SingleDerivedPath>(SingleDerivedPath::Opaque{drvPath});
|
||||||
|
initPlaceholders(basePath, outputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto parseSingleDerivedPath = [&](const std::string & pathS) -> SingleDerivedPath {
|
||||||
|
if (auto it = placeholders.find(pathS); it != placeholders.end())
|
||||||
|
return it->second;
|
||||||
|
else
|
||||||
|
return SingleDerivedPath::Opaque{store.toStorePath(pathS).first};
|
||||||
|
};
|
||||||
|
|
||||||
|
auto parseRef = [&](const std::string & pathS) -> DrvRef<SingleDerivedPath> {
|
||||||
|
if (auto it = placeholders.find(pathS); it != placeholders.end())
|
||||||
|
return it->second;
|
||||||
|
if (store.isStorePath(pathS))
|
||||||
|
return SingleDerivedPath::Opaque{store.toStorePath(pathS).first};
|
||||||
|
else
|
||||||
|
return pathS;
|
||||||
|
};
|
||||||
|
|
||||||
if (shouldWarn && parsed) {
|
if (shouldWarn && parsed) {
|
||||||
auto & structuredAttrs = parsed->structuredAttrs;
|
auto & structuredAttrs = parsed->structuredAttrs;
|
||||||
|
|
@ -146,30 +248,21 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.outputChecks = [&]() -> OutputChecksVariant {
|
.outputChecks = [&]() -> OutputChecksVariant<SingleDerivedPath> {
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
auto & structuredAttrs = parsed->structuredAttrs;
|
std::map<std::string, OutputChecks<SingleDerivedPath>> res;
|
||||||
|
if (auto * outputChecks = get(parsed->structuredAttrs, "outputChecks")) {
|
||||||
std::map<std::string, OutputChecks> res;
|
|
||||||
if (auto * outputChecks = get(structuredAttrs, "outputChecks")) {
|
|
||||||
for (auto & [outputName, output_] : getObject(*outputChecks)) {
|
for (auto & [outputName, output_] : getObject(*outputChecks)) {
|
||||||
OutputChecks checks;
|
|
||||||
|
|
||||||
auto & output = getObject(output_);
|
auto & output = getObject(output_);
|
||||||
|
|
||||||
if (auto maxSize = get(output, "maxSize"))
|
auto get_ =
|
||||||
checks.maxSize = maxSize->get<uint64_t>();
|
[&](const std::string & name) -> std::optional<std::set<DrvRef<SingleDerivedPath>>> {
|
||||||
|
|
||||||
if (auto maxClosureSize = get(output, "maxClosureSize"))
|
|
||||||
checks.maxClosureSize = maxClosureSize->get<uint64_t>();
|
|
||||||
|
|
||||||
auto get_ = [&output = output](const std::string & name) -> std::optional<StringSet> {
|
|
||||||
if (auto i = get(output, name)) {
|
if (auto i = get(output, name)) {
|
||||||
StringSet res;
|
std::set<DrvRef<SingleDerivedPath>> res;
|
||||||
for (auto j = i->begin(); j != i->end(); ++j) {
|
for (auto j = i->begin(); j != i->end(); ++j) {
|
||||||
if (!j->is_string())
|
if (!j->is_string())
|
||||||
throw Error("attribute '%s' must be a list of strings", name);
|
throw Error("attribute '%s' must be a list of strings", name);
|
||||||
res.insert(j->get<std::string>());
|
res.insert(parseRef(j->get<std::string>()));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +271,7 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
|
|
||||||
res.insert_or_assign(
|
res.insert_or_assign(
|
||||||
outputName,
|
outputName,
|
||||||
OutputChecks{
|
OutputChecks<SingleDerivedPath>{
|
||||||
.maxSize = [&]() -> std::optional<uint64_t> {
|
.maxSize = [&]() -> std::optional<uint64_t> {
|
||||||
if (auto maxSize = get(output, "maxSize"))
|
if (auto maxSize = get(output, "maxSize"))
|
||||||
return maxSize->get<uint64_t>();
|
return maxSize->get<uint64_t>();
|
||||||
|
|
@ -192,21 +285,32 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}(),
|
}(),
|
||||||
.allowedReferences = get_("allowedReferences"),
|
.allowedReferences = get_("allowedReferences"),
|
||||||
.disallowedReferences = get_("disallowedReferences").value_or(StringSet{}),
|
.disallowedReferences =
|
||||||
|
get_("disallowedReferences").value_or(std::set<DrvRef<SingleDerivedPath>>{}),
|
||||||
.allowedRequisites = get_("allowedRequisites"),
|
.allowedRequisites = get_("allowedRequisites"),
|
||||||
.disallowedRequisites = get_("disallowedRequisites").value_or(StringSet{}),
|
.disallowedRequisites =
|
||||||
|
get_("disallowedRequisites").value_or(std::set<DrvRef<SingleDerivedPath>>{}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
return OutputChecks{
|
auto parseRefSet = [&](const std::optional<StringSet> optionalStringSet)
|
||||||
|
-> std::optional<std::set<DrvRef<SingleDerivedPath>>> {
|
||||||
|
if (!optionalStringSet)
|
||||||
|
return std::nullopt;
|
||||||
|
auto range = *optionalStringSet | std::views::transform(parseRef);
|
||||||
|
return std::set<DrvRef<SingleDerivedPath>>(range.begin(), range.end());
|
||||||
|
};
|
||||||
|
return OutputChecks<SingleDerivedPath>{
|
||||||
// legacy non-structured-attributes case
|
// legacy non-structured-attributes case
|
||||||
.ignoreSelfRefs = true,
|
.ignoreSelfRefs = true,
|
||||||
.allowedReferences = getStringSetAttr(env, parsed, "allowedReferences"),
|
.allowedReferences = parseRefSet(getStringSetAttr(env, parsed, "allowedReferences")),
|
||||||
.disallowedReferences = getStringSetAttr(env, parsed, "disallowedReferences").value_or(StringSet{}),
|
.disallowedReferences = parseRefSet(getStringSetAttr(env, parsed, "disallowedReferences"))
|
||||||
.allowedRequisites = getStringSetAttr(env, parsed, "allowedRequisites"),
|
.value_or(std::set<DrvRef<SingleDerivedPath>>{}),
|
||||||
.disallowedRequisites = getStringSetAttr(env, parsed, "disallowedRequisites").value_or(StringSet{}),
|
.allowedRequisites = parseRefSet(getStringSetAttr(env, parsed, "allowedRequisites")),
|
||||||
|
.disallowedRequisites = parseRefSet(getStringSetAttr(env, parsed, "disallowedRequisites"))
|
||||||
|
.value_or(std::set<DrvRef<SingleDerivedPath>>{}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
|
|
@ -245,16 +349,19 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
}(),
|
}(),
|
||||||
.exportReferencesGraph =
|
.exportReferencesGraph =
|
||||||
[&] {
|
[&] {
|
||||||
std::map<std::string, StringSet> ret;
|
std::map<std::string, std::set<SingleDerivedPath>> ret;
|
||||||
|
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
auto * e = optionalValueAt(parsed->structuredAttrs, "exportReferencesGraph");
|
auto * e = optionalValueAt(parsed->structuredAttrs, "exportReferencesGraph");
|
||||||
if (!e || !e->is_object())
|
if (!e || !e->is_object())
|
||||||
return ret;
|
return ret;
|
||||||
for (auto & [key, value] : getObject(*e)) {
|
for (auto & [key, storePathsJson] : getObject(*e)) {
|
||||||
StringSet ss;
|
StringSet ss;
|
||||||
flatten(value, ss);
|
flatten(storePathsJson, ss);
|
||||||
ret.insert_or_assign(key, std::move(ss));
|
std::set<SingleDerivedPath> storePaths;
|
||||||
|
for (auto & s : ss)
|
||||||
|
storePaths.insert(parseSingleDerivedPath(s));
|
||||||
|
ret.insert_or_assign(key, std::move(storePaths));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto s = getOr(env, "exportReferencesGraph", "");
|
auto s = getOr(env, "exportReferencesGraph", "");
|
||||||
|
|
@ -268,7 +375,7 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
throw Error("invalid file name '%s' in 'exportReferencesGraph'", fileName);
|
throw Error("invalid file name '%s' in 'exportReferencesGraph'", fileName);
|
||||||
|
|
||||||
auto & storePathS = *i++;
|
auto & storePathS = *i++;
|
||||||
ret.insert_or_assign(std::move(fileName), StringSet{storePathS});
|
ret.insert_or_assign(std::move(fileName), std::set{parseSingleDerivedPath(storePathS)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -286,28 +393,8 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, StorePathSet>
|
template<typename Input>
|
||||||
DerivationOptions::getParsedExportReferencesGraph(const StoreDirConfig & store) const
|
StringSet DerivationOptions<Input>::getRequiredSystemFeatures(const BasicDerivation & drv) const
|
||||||
{
|
|
||||||
std::map<std::string, StorePathSet> res;
|
|
||||||
|
|
||||||
for (auto & [fileName, ss] : exportReferencesGraph) {
|
|
||||||
StorePathSet storePaths;
|
|
||||||
for (auto & storePathS : ss) {
|
|
||||||
if (!store.isInStore(storePathS))
|
|
||||||
throw BuildError(
|
|
||||||
BuildResult::Failure::InputRejected,
|
|
||||||
"'exportReferencesGraph' contains a non-store path '%1%'",
|
|
||||||
storePathS);
|
|
||||||
storePaths.insert(store.toStorePath(storePathS).first);
|
|
||||||
}
|
|
||||||
res.insert_or_assign(fileName, storePaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringSet DerivationOptions::getRequiredSystemFeatures(const BasicDerivation & drv) const
|
|
||||||
{
|
{
|
||||||
// FIXME: cache this?
|
// FIXME: cache this?
|
||||||
StringSet res;
|
StringSet res;
|
||||||
|
|
@ -318,7 +405,8 @@ StringSet DerivationOptions::getRequiredSystemFeatures(const BasicDerivation & d
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DerivationOptions::canBuildLocally(Store & localStore, const BasicDerivation & drv) const
|
template<typename Input>
|
||||||
|
bool DerivationOptions<Input>::canBuildLocally(Store & localStore, const BasicDerivation & drv) const
|
||||||
{
|
{
|
||||||
if (drv.platform != settings.thisSystem.get() && !settings.extraPlatforms.get().count(drv.platform)
|
if (drv.platform != settings.thisSystem.get() && !settings.extraPlatforms.get().count(drv.platform)
|
||||||
&& !drv.isBuiltin())
|
&& !drv.isBuiltin())
|
||||||
|
|
@ -334,42 +422,194 @@ bool DerivationOptions::canBuildLocally(Store & localStore, const BasicDerivatio
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DerivationOptions::willBuildLocally(Store & localStore, const BasicDerivation & drv) const
|
template<typename Input>
|
||||||
|
bool DerivationOptions<Input>::willBuildLocally(Store & localStore, const BasicDerivation & drv) const
|
||||||
{
|
{
|
||||||
return preferLocalBuild && canBuildLocally(localStore, drv);
|
return preferLocalBuild && canBuildLocally(localStore, drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DerivationOptions::substitutesAllowed() const
|
template<typename Input>
|
||||||
|
bool DerivationOptions<Input>::substitutesAllowed() const
|
||||||
{
|
{
|
||||||
return settings.alwaysAllowSubstitutes ? true : allowSubstitutes;
|
return settings.alwaysAllowSubstitutes ? true : allowSubstitutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DerivationOptions::useUidRange(const BasicDerivation & drv) const
|
template<typename Input>
|
||||||
|
bool DerivationOptions<Input>::useUidRange(const BasicDerivation & drv) const
|
||||||
{
|
{
|
||||||
return getRequiredSystemFeatures(drv).count("uid-range");
|
return getRequiredSystemFeatures(drv).count("uid-range");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<DerivationOptions<StorePath>> tryResolve(
|
||||||
|
const DerivationOptions<SingleDerivedPath> & drvOptions,
|
||||||
|
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
||||||
|
queryResolutionChain)
|
||||||
|
{
|
||||||
|
auto tryResolvePath = [&](const SingleDerivedPath & input) -> std::optional<StorePath> {
|
||||||
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[](const SingleDerivedPath::Opaque & p) -> std::optional<StorePath> { return p.path; },
|
||||||
|
[&](const SingleDerivedPath::Built & p) -> std::optional<StorePath> {
|
||||||
|
return queryResolutionChain(p.drvPath, p.output);
|
||||||
|
}},
|
||||||
|
input.raw());
|
||||||
|
};
|
||||||
|
|
||||||
|
auto tryResolveRef = [&](const DrvRef<SingleDerivedPath> & ref) -> std::optional<DrvRef<StorePath>> {
|
||||||
|
return std::visit(
|
||||||
|
overloaded{
|
||||||
|
[](const OutputName & outputName) -> std::optional<DrvRef<StorePath>> { return outputName; },
|
||||||
|
[&](const SingleDerivedPath & input) -> std::optional<DrvRef<StorePath>> {
|
||||||
|
return tryResolvePath(input);
|
||||||
|
}},
|
||||||
|
ref);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto tryResolveRefSet =
|
||||||
|
[&](const std::set<DrvRef<SingleDerivedPath>> & refSet) -> std::optional<std::set<DrvRef<StorePath>>> {
|
||||||
|
std::set<DrvRef<StorePath>> resolvedSet;
|
||||||
|
for (const auto & ref : refSet) {
|
||||||
|
auto resolvedRef = tryResolveRef(ref);
|
||||||
|
if (!resolvedRef)
|
||||||
|
return std::nullopt;
|
||||||
|
resolvedSet.insert(*resolvedRef);
|
||||||
|
}
|
||||||
|
return resolvedSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to try resolving OutputChecks using functional style
|
||||||
|
auto tryResolveOutputChecks = [&](const DerivationOptions<SingleDerivedPath>::OutputChecks & checks)
|
||||||
|
-> std::optional<DerivationOptions<StorePath>::OutputChecks> {
|
||||||
|
std::optional<std::set<DrvRef<StorePath>>> resolvedAllowedReferences;
|
||||||
|
if (checks.allowedReferences) {
|
||||||
|
resolvedAllowedReferences = tryResolveRefSet(*checks.allowedReferences);
|
||||||
|
if (!resolvedAllowedReferences)
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::set<DrvRef<StorePath>>> resolvedAllowedRequisites;
|
||||||
|
if (checks.allowedRequisites) {
|
||||||
|
resolvedAllowedRequisites = tryResolveRefSet(*checks.allowedRequisites);
|
||||||
|
if (!resolvedAllowedRequisites)
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto resolvedDisallowedReferences = tryResolveRefSet(checks.disallowedReferences);
|
||||||
|
if (!resolvedDisallowedReferences)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
auto resolvedDisallowedRequisites = tryResolveRefSet(checks.disallowedRequisites);
|
||||||
|
if (!resolvedDisallowedRequisites)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return DerivationOptions<StorePath>::OutputChecks{
|
||||||
|
.ignoreSelfRefs = checks.ignoreSelfRefs,
|
||||||
|
.maxSize = checks.maxSize,
|
||||||
|
.maxClosureSize = checks.maxClosureSize,
|
||||||
|
.allowedReferences = resolvedAllowedReferences,
|
||||||
|
.disallowedReferences = *resolvedDisallowedReferences,
|
||||||
|
.allowedRequisites = resolvedAllowedRequisites,
|
||||||
|
.disallowedRequisites = *resolvedDisallowedRequisites,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to resolve exportReferencesGraph using functional style
|
||||||
|
auto tryResolveExportReferencesGraph = [&](const std::map<std::string, std::set<SingleDerivedPath>> & exportGraph)
|
||||||
|
-> std::optional<std::map<std::string, std::set<StorePath>>> {
|
||||||
|
std::map<std::string, std::set<StorePath>> resolved;
|
||||||
|
for (const auto & [name, inputPaths] : exportGraph) {
|
||||||
|
std::set<StorePath> resolvedPaths;
|
||||||
|
for (const auto & inputPath : inputPaths) {
|
||||||
|
auto resolvedPath = tryResolvePath(inputPath);
|
||||||
|
if (!resolvedPath)
|
||||||
|
return std::nullopt;
|
||||||
|
resolvedPaths.insert(*resolvedPath);
|
||||||
|
}
|
||||||
|
resolved.emplace(name, std::move(resolvedPaths));
|
||||||
|
}
|
||||||
|
return resolved;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Resolve outputChecks using functional style with std::visit
|
||||||
|
auto resolvedOutputChecks = std::visit(
|
||||||
|
overloaded{
|
||||||
|
[&](const DerivationOptions<SingleDerivedPath>::OutputChecks & checks)
|
||||||
|
-> std::optional<std::variant<
|
||||||
|
DerivationOptions<StorePath>::OutputChecks,
|
||||||
|
std::map<std::string, DerivationOptions<StorePath>::OutputChecks>>> {
|
||||||
|
auto resolved = tryResolveOutputChecks(checks);
|
||||||
|
if (!resolved)
|
||||||
|
return std::nullopt;
|
||||||
|
return std::variant<
|
||||||
|
DerivationOptions<StorePath>::OutputChecks,
|
||||||
|
std::map<std::string, DerivationOptions<StorePath>::OutputChecks>>(*resolved);
|
||||||
|
},
|
||||||
|
[&](const std::map<std::string, DerivationOptions<SingleDerivedPath>::OutputChecks> & checksMap)
|
||||||
|
-> std::optional<std::variant<
|
||||||
|
DerivationOptions<StorePath>::OutputChecks,
|
||||||
|
std::map<std::string, DerivationOptions<StorePath>::OutputChecks>>> {
|
||||||
|
std::map<std::string, DerivationOptions<StorePath>::OutputChecks> resolvedMap;
|
||||||
|
for (const auto & [outputName, checks] : checksMap) {
|
||||||
|
auto resolved = tryResolveOutputChecks(checks);
|
||||||
|
if (!resolved)
|
||||||
|
return std::nullopt;
|
||||||
|
resolvedMap.emplace(outputName, *resolved);
|
||||||
|
}
|
||||||
|
return std::variant<
|
||||||
|
DerivationOptions<StorePath>::OutputChecks,
|
||||||
|
std::map<std::string, DerivationOptions<StorePath>::OutputChecks>>(resolvedMap);
|
||||||
|
}},
|
||||||
|
drvOptions.outputChecks);
|
||||||
|
|
||||||
|
if (!resolvedOutputChecks)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
// Resolve exportReferencesGraph
|
||||||
|
auto resolvedExportGraph = tryResolveExportReferencesGraph(drvOptions.exportReferencesGraph);
|
||||||
|
if (!resolvedExportGraph)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
// Return resolved DerivationOptions using designated initializers
|
||||||
|
return DerivationOptions<StorePath>{
|
||||||
|
.outputChecks = *resolvedOutputChecks,
|
||||||
|
.unsafeDiscardReferences = drvOptions.unsafeDiscardReferences,
|
||||||
|
.passAsFile = drvOptions.passAsFile,
|
||||||
|
.exportReferencesGraph = *resolvedExportGraph,
|
||||||
|
.additionalSandboxProfile = drvOptions.additionalSandboxProfile,
|
||||||
|
.noChroot = drvOptions.noChroot,
|
||||||
|
.impureHostDeps = drvOptions.impureHostDeps,
|
||||||
|
.impureEnvVars = drvOptions.impureEnvVars,
|
||||||
|
.allowLocalNetworking = drvOptions.allowLocalNetworking,
|
||||||
|
.requiredSystemFeatures = drvOptions.requiredSystemFeatures,
|
||||||
|
.preferLocalBuild = drvOptions.preferLocalBuild,
|
||||||
|
.allowSubstitutes = drvOptions.allowSubstitutes,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template struct DerivationOptions<StorePath>;
|
||||||
|
template struct DerivationOptions<SingleDerivedPath>;
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
||||||
namespace nlohmann {
|
namespace nlohmann {
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
|
||||||
DerivationOptions adl_serializer<DerivationOptions>::from_json(const json & json_)
|
DerivationOptions<SingleDerivedPath> adl_serializer<DerivationOptions<SingleDerivedPath>>::from_json(const json & json_)
|
||||||
{
|
{
|
||||||
auto & json = getObject(json_);
|
auto & json = getObject(json_);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.outputChecks = [&]() -> OutputChecksVariant {
|
.outputChecks = [&]() -> OutputChecksVariant<SingleDerivedPath> {
|
||||||
auto outputChecks = getObject(valueAt(json, "outputChecks"));
|
auto outputChecks = getObject(valueAt(json, "outputChecks"));
|
||||||
|
|
||||||
auto forAllOutputsOpt = optionalValueAt(outputChecks, "forAllOutputs");
|
auto forAllOutputsOpt = optionalValueAt(outputChecks, "forAllOutputs");
|
||||||
auto perOutputOpt = optionalValueAt(outputChecks, "perOutput");
|
auto perOutputOpt = optionalValueAt(outputChecks, "perOutput");
|
||||||
|
|
||||||
if (forAllOutputsOpt && !perOutputOpt) {
|
if (forAllOutputsOpt && !perOutputOpt) {
|
||||||
return static_cast<OutputChecks>(*forAllOutputsOpt);
|
return static_cast<OutputChecks<SingleDerivedPath>>(*forAllOutputsOpt);
|
||||||
} else if (perOutputOpt && !forAllOutputsOpt) {
|
} else if (perOutputOpt && !forAllOutputsOpt) {
|
||||||
return static_cast<std::map<std::string, OutputChecks>>(*perOutputOpt);
|
return static_cast<std::map<std::string, OutputChecks<SingleDerivedPath>>>(*perOutputOpt);
|
||||||
} else {
|
} else {
|
||||||
throw Error("Exactly one of 'perOutput' or 'forAllOutputs' is required");
|
throw Error("Exactly one of 'perOutput' or 'forAllOutputs' is required");
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +617,7 @@ DerivationOptions adl_serializer<DerivationOptions>::from_json(const json & json
|
||||||
|
|
||||||
.unsafeDiscardReferences = valueAt(json, "unsafeDiscardReferences"),
|
.unsafeDiscardReferences = valueAt(json, "unsafeDiscardReferences"),
|
||||||
.passAsFile = getStringSet(valueAt(json, "passAsFile")),
|
.passAsFile = getStringSet(valueAt(json, "passAsFile")),
|
||||||
.exportReferencesGraph = getMap<StringSet>(getObject(valueAt(json, "exportReferencesGraph")), getStringSet),
|
.exportReferencesGraph = valueAt(json, "exportReferencesGraph"),
|
||||||
|
|
||||||
.additionalSandboxProfile = getString(valueAt(json, "additionalSandboxProfile")),
|
.additionalSandboxProfile = getString(valueAt(json, "additionalSandboxProfile")),
|
||||||
.noChroot = getBoolean(valueAt(json, "noChroot")),
|
.noChroot = getBoolean(valueAt(json, "noChroot")),
|
||||||
|
|
@ -391,16 +631,17 @@ DerivationOptions adl_serializer<DerivationOptions>::from_json(const json & json
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void adl_serializer<DerivationOptions>::to_json(json & json, const DerivationOptions & o)
|
void adl_serializer<DerivationOptions<SingleDerivedPath>>::to_json(
|
||||||
|
json & json, const DerivationOptions<SingleDerivedPath> & o)
|
||||||
{
|
{
|
||||||
json["outputChecks"] = std::visit(
|
json["outputChecks"] = std::visit(
|
||||||
overloaded{
|
overloaded{
|
||||||
[&](const OutputChecks & checks) {
|
[&](const OutputChecks<SingleDerivedPath> & checks) {
|
||||||
nlohmann::json outputChecks;
|
nlohmann::json outputChecks;
|
||||||
outputChecks["forAllOutputs"] = checks;
|
outputChecks["forAllOutputs"] = checks;
|
||||||
return outputChecks;
|
return outputChecks;
|
||||||
},
|
},
|
||||||
[&](const std::map<std::string, OutputChecks> & checksPerOutput) {
|
[&](const std::map<std::string, OutputChecks<SingleDerivedPath>> & checksPerOutput) {
|
||||||
nlohmann::json outputChecks;
|
nlohmann::json outputChecks;
|
||||||
outputChecks["perOutput"] = checksPerOutput;
|
outputChecks["perOutput"] = checksPerOutput;
|
||||||
return outputChecks;
|
return outputChecks;
|
||||||
|
|
@ -432,7 +673,7 @@ static inline std::optional<T> ptrToOwned(const json * ptr)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
DerivationOptions::OutputChecks adl_serializer<DerivationOptions::OutputChecks>::from_json(const json & json_)
|
OutputChecks<SingleDerivedPath> adl_serializer<OutputChecks<SingleDerivedPath>>::from_json(const json & json_)
|
||||||
{
|
{
|
||||||
auto & json = getObject(json_);
|
auto & json = getObject(json_);
|
||||||
|
|
||||||
|
|
@ -440,14 +681,16 @@ DerivationOptions::OutputChecks adl_serializer<DerivationOptions::OutputChecks>:
|
||||||
.ignoreSelfRefs = getBoolean(valueAt(json, "ignoreSelfRefs")),
|
.ignoreSelfRefs = getBoolean(valueAt(json, "ignoreSelfRefs")),
|
||||||
.maxSize = ptrToOwned<uint64_t>(getNullable(valueAt(json, "maxSize"))),
|
.maxSize = ptrToOwned<uint64_t>(getNullable(valueAt(json, "maxSize"))),
|
||||||
.maxClosureSize = ptrToOwned<uint64_t>(getNullable(valueAt(json, "maxClosureSize"))),
|
.maxClosureSize = ptrToOwned<uint64_t>(getNullable(valueAt(json, "maxClosureSize"))),
|
||||||
.allowedReferences = ptrToOwned<StringSet>(getNullable(valueAt(json, "allowedReferences"))),
|
.allowedReferences =
|
||||||
.disallowedReferences = getStringSet(valueAt(json, "disallowedReferences")),
|
ptrToOwned<std::set<DrvRef<SingleDerivedPath>>>(getNullable(valueAt(json, "allowedReferences"))),
|
||||||
.allowedRequisites = ptrToOwned<StringSet>(getNullable(valueAt(json, "allowedRequisites"))),
|
.disallowedReferences = valueAt(json, "disallowedReferences"),
|
||||||
.disallowedRequisites = getStringSet(valueAt(json, "disallowedRequisites")),
|
.allowedRequisites =
|
||||||
|
ptrToOwned<std::set<DrvRef<SingleDerivedPath>>>(getNullable(valueAt(json, "allowedRequisites"))),
|
||||||
|
.disallowedRequisites = valueAt(json, "disallowedRequisites"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void adl_serializer<DerivationOptions::OutputChecks>::to_json(json & json, const DerivationOptions::OutputChecks & c)
|
void adl_serializer<OutputChecks<SingleDerivedPath>>::to_json(json & json, const OutputChecks<SingleDerivedPath> & c)
|
||||||
{
|
{
|
||||||
json["ignoreSelfRefs"] = c.ignoreSelfRefs;
|
json["ignoreSelfRefs"] = c.ignoreSelfRefs;
|
||||||
json["maxSize"] = c.maxSize;
|
json["maxSize"] = c.maxSize;
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,9 @@ Derivation parseDerivation(
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(str, ')');
|
expect(str, ')');
|
||||||
|
|
||||||
|
drv.options = derivationOptionsFromStructuredAttrs(store, drv.inputDrvs, drv.env, drv.structuredAttrs);
|
||||||
|
|
||||||
return drv;
|
return drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,6 +637,14 @@ static bool hasDynamicDrvDep(const Derivation & drv)
|
||||||
std::string Derivation::unparse(
|
std::string Derivation::unparse(
|
||||||
const StoreDirConfig & store, bool maskOutputs, DerivedPathMap<StringSet>::ChildNode::Map * actualInputs) const
|
const StoreDirConfig & store, bool maskOutputs, DerivedPathMap<StringSet>::ChildNode::Map * actualInputs) const
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
auto optionsFromEnv = derivationOptionsFromStructuredAttrs(store, inputDrvs, env, structuredAttrs);
|
||||||
|
|
||||||
|
if (optionsFromEnv != options)
|
||||||
|
throw Error(
|
||||||
|
"'drv.options' and 'drv.env' are out of sync. This is probably an internal error, please open an issue!");
|
||||||
|
}
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
s.reserve(65536);
|
s.reserve(65536);
|
||||||
|
|
||||||
|
|
@ -1127,7 +1138,8 @@ static void rewriteDerivation(Store & store, BasicDerivation & drv, const String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<BasicDerivation> Derivation::tryResolve(Store & store, Store * evalStore) const
|
std::optional<std::pair<BasicDerivation, DerivationOptions<StorePath>>>
|
||||||
|
Derivation::tryResolve(Store & store, Store * evalStore) const
|
||||||
{
|
{
|
||||||
return tryResolve(
|
return tryResolve(
|
||||||
store, [&](ref<const SingleDerivedPath> drvPath, const std::string & outputName) -> std::optional<StorePath> {
|
store, [&](ref<const SingleDerivedPath> drvPath, const std::string & outputName) -> std::optional<StorePath> {
|
||||||
|
|
@ -1184,7 +1196,7 @@ static bool tryResolveInput(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<BasicDerivation> Derivation::tryResolve(
|
std::optional<std::pair<BasicDerivation, DerivationOptions<StorePath>>> Derivation::tryResolve(
|
||||||
Store & store,
|
Store & store,
|
||||||
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
||||||
queryResolutionChain) const
|
queryResolutionChain) const
|
||||||
|
|
@ -1207,7 +1219,12 @@ std::optional<BasicDerivation> Derivation::tryResolve(
|
||||||
|
|
||||||
rewriteDerivation(store, resolved, inputRewrites);
|
rewriteDerivation(store, resolved, inputRewrites);
|
||||||
|
|
||||||
return resolved;
|
auto resolvedOptions = nix::tryResolve(options, queryResolutionChain);
|
||||||
|
|
||||||
|
if (!resolvedOptions)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
return {{std::move(resolved), *std::move(resolvedOptions)}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Derivation::checkInvariants(Store & store, const StorePath & drvPath) const
|
void Derivation::checkInvariants(Store & store, const StorePath & drvPath) const
|
||||||
|
|
@ -1431,6 +1448,7 @@ void adl_serializer<Derivation>::to_json(json & res, const Derivation & d)
|
||||||
res["builder"] = d.builder;
|
res["builder"] = d.builder;
|
||||||
res["args"] = d.args;
|
res["args"] = d.args;
|
||||||
res["env"] = d.env;
|
res["env"] = d.env;
|
||||||
|
res["options"] = d.options;
|
||||||
|
|
||||||
if (d.structuredAttrs)
|
if (d.structuredAttrs)
|
||||||
res["structuredAttrs"] = d.structuredAttrs->structuredAttrs;
|
res["structuredAttrs"] = d.structuredAttrs->structuredAttrs;
|
||||||
|
|
@ -1511,6 +1529,11 @@ Derivation adl_serializer<Derivation>::from_json(const json & _json, const Exper
|
||||||
if (auto structuredAttrs = get(json, "structuredAttrs"))
|
if (auto structuredAttrs = get(json, "structuredAttrs"))
|
||||||
res.structuredAttrs = StructuredAttrs{*structuredAttrs};
|
res.structuredAttrs = StructuredAttrs{*structuredAttrs};
|
||||||
|
|
||||||
|
if (auto options = get(json, "options"))
|
||||||
|
res.options = *options;
|
||||||
|
else
|
||||||
|
res.options = derivationOptionsFromStructuredAttrs(store, res.inputDrvs, res.env, res.structuredAttrs);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "nix/store/downstream-placeholder.hh"
|
#include "nix/store/downstream-placeholder.hh"
|
||||||
#include "nix/store/derivations.hh"
|
#include "nix/store/derivations.hh"
|
||||||
|
#include "nix/util/json-utils.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
@ -49,3 +50,45 @@ DownstreamPlaceholder DownstreamPlaceholder::fromSingleDerivedPathBuilt(
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
||||||
|
namespace nlohmann {
|
||||||
|
|
||||||
|
using namespace nix;
|
||||||
|
|
||||||
|
template<typename Item>
|
||||||
|
DrvRef<Item> adl_serializer<DrvRef<Item>>::from_json(const json & json)
|
||||||
|
{
|
||||||
|
// OutputName case: { "drvPath": "self", "output": <output> }
|
||||||
|
if (json.type() == nlohmann::json::value_t::object) {
|
||||||
|
auto & obj = getObject(json);
|
||||||
|
if (auto * drvPath_ = get(obj, "drvPath")) {
|
||||||
|
auto & drvPath = *drvPath_;
|
||||||
|
if (drvPath.type() == nlohmann::json::value_t::string && getString(drvPath) == "self") {
|
||||||
|
return getString(valueAt(obj, "output"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input case
|
||||||
|
return adl_serializer<Item>::from_json(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Item>
|
||||||
|
void adl_serializer<DrvRef<Item>>::to_json(json & json, const DrvRef<Item> & ref)
|
||||||
|
{
|
||||||
|
std::visit(
|
||||||
|
overloaded{
|
||||||
|
[&](const OutputName & outputName) {
|
||||||
|
json = nlohmann::json::object();
|
||||||
|
json["drvPath"] = "self";
|
||||||
|
json["output"] = outputName;
|
||||||
|
},
|
||||||
|
[&](const Item & item) { json = item; },
|
||||||
|
},
|
||||||
|
ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
template struct adl_serializer<nix::DrvRef<StorePath>>;
|
||||||
|
template struct adl_serializer<nix::DrvRef<SingleDerivedPath>>;
|
||||||
|
|
||||||
|
} // namespace nlohmann
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,10 @@ struct DerivationBuilderParams
|
||||||
/**
|
/**
|
||||||
* The derivation options of `drv`.
|
* The derivation options of `drv`.
|
||||||
*
|
*
|
||||||
* @todo this should be part of `Derivation`.
|
* @todo this should be part of `Derivation`/`BasicDerivation`, if
|
||||||
|
* those two were distinguished by type arguments not subtyping.
|
||||||
*/
|
*/
|
||||||
const DerivationOptions & drvOptions;
|
const DerivationOptions<StorePath> & drvOptions;
|
||||||
|
|
||||||
// The remainder is state held during the build.
|
// The remainder is state held during the build.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ private:
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<Derivation> drv;
|
std::unique_ptr<Derivation> drv;
|
||||||
|
|
||||||
std::unique_ptr<DerivationOptions> drvOptions;
|
std::unique_ptr<DerivationOptions<StorePath>> drvOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The remainder is state held during the build.
|
* The remainder is state held during the build.
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace nix {
|
||||||
|
|
||||||
class Store;
|
class Store;
|
||||||
struct Derivation;
|
struct Derivation;
|
||||||
|
template<typename Input>
|
||||||
struct DerivationOptions;
|
struct DerivationOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,7 +78,10 @@ struct DesugaredEnv
|
||||||
* just part of `Derivation`.
|
* just part of `Derivation`.
|
||||||
*/
|
*/
|
||||||
static DesugaredEnv create(
|
static DesugaredEnv create(
|
||||||
Store & store, const Derivation & drv, const DerivationOptions & drvOptions, const StorePathSet & inputPaths);
|
Store & store,
|
||||||
|
const Derivation & drv,
|
||||||
|
const DerivationOptions<StorePath> & drvOptions,
|
||||||
|
const StorePathSet & inputPaths);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
///@file
|
///@file
|
||||||
|
|
||||||
#include "nix/store/parsed-derivations.hh"
|
|
||||||
#include "nix/store/derivations.hh"
|
#include "nix/store/derivations.hh"
|
||||||
#include "nix/store/derivation-options.hh"
|
#include "nix/store/derivation-options.hh"
|
||||||
#include "nix/store/build/derivation-building-misc.hh"
|
#include "nix/store/build/derivation-building-misc.hh"
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ struct DerivationResolutionGoal : public Goal
|
||||||
* If the derivation needed to be resolved, this is resulting
|
* If the derivation needed to be resolved, this is resulting
|
||||||
* resolved derivations and its path.
|
* resolved derivations and its path.
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<std::pair<StorePath, BasicDerivation>> resolvedDrv;
|
std::unique_ptr<std::tuple<StorePath, BasicDerivation, DerivationOptions<StorePath>>> resolvedDrv;
|
||||||
|
|
||||||
void timedOut(Error && ex) override {}
|
void timedOut(Error && ex) override {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
#include "nix/util/types.hh"
|
#include "nix/util/types.hh"
|
||||||
#include "nix/util/json-impls.hh"
|
#include "nix/util/json-impls.hh"
|
||||||
#include "nix/store/path.hh"
|
#include "nix/store/store-dir-config.hh"
|
||||||
|
#include "nix/store/downstream-placeholder.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
@ -17,6 +18,9 @@ struct StoreDirConfig;
|
||||||
struct BasicDerivation;
|
struct BasicDerivation;
|
||||||
struct StructuredAttrs;
|
struct StructuredAttrs;
|
||||||
|
|
||||||
|
template<typename V>
|
||||||
|
struct DerivedPathMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This represents all the special options on a `Derivation`.
|
* This represents all the special options on a `Derivation`.
|
||||||
*
|
*
|
||||||
|
|
@ -34,6 +38,7 @@ struct StructuredAttrs;
|
||||||
* separately. That would be nice to separate concerns, and not make any
|
* separately. That would be nice to separate concerns, and not make any
|
||||||
* environment variable names magical.
|
* environment variable names magical.
|
||||||
*/
|
*/
|
||||||
|
template<typename Input>
|
||||||
struct DerivationOptions
|
struct DerivationOptions
|
||||||
{
|
{
|
||||||
struct OutputChecks
|
struct OutputChecks
|
||||||
|
|
@ -41,13 +46,15 @@ struct DerivationOptions
|
||||||
bool ignoreSelfRefs = false;
|
bool ignoreSelfRefs = false;
|
||||||
std::optional<uint64_t> maxSize, maxClosureSize;
|
std::optional<uint64_t> maxSize, maxClosureSize;
|
||||||
|
|
||||||
|
using DrvRef = nix::DrvRef<Input>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* env: allowedReferences
|
* env: allowedReferences
|
||||||
*
|
*
|
||||||
* A value of `nullopt` indicates that the check is skipped.
|
* A value of `nullopt` indicates that the check is skipped.
|
||||||
* This means that all references are allowed.
|
* This means that all references are allowed.
|
||||||
*/
|
*/
|
||||||
std::optional<StringSet> allowedReferences;
|
std::optional<std::set<DrvRef>> allowedReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* env: disallowedReferences
|
* env: disallowedReferences
|
||||||
|
|
@ -55,21 +62,21 @@ struct DerivationOptions
|
||||||
* No needed for `std::optional`, because skipping the check is
|
* No needed for `std::optional`, because skipping the check is
|
||||||
* the same as disallowing the references.
|
* the same as disallowing the references.
|
||||||
*/
|
*/
|
||||||
StringSet disallowedReferences;
|
std::set<DrvRef> disallowedReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* env: allowedRequisites
|
* env: allowedRequisites
|
||||||
*
|
*
|
||||||
* See `allowedReferences`
|
* See `allowedReferences`
|
||||||
*/
|
*/
|
||||||
std::optional<StringSet> allowedRequisites;
|
std::optional<std::set<DrvRef>> allowedRequisites;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* env: disallowedRequisites
|
* env: disallowedRequisites
|
||||||
*
|
*
|
||||||
* See `disallowedReferences`
|
* See `disallowedReferences`
|
||||||
*/
|
*/
|
||||||
StringSet disallowedRequisites;
|
std::set<DrvRef> disallowedRequisites;
|
||||||
|
|
||||||
bool operator==(const OutputChecks &) const = default;
|
bool operator==(const OutputChecks &) const = default;
|
||||||
};
|
};
|
||||||
|
|
@ -116,23 +123,7 @@ struct DerivationOptions
|
||||||
* attributes give to the builder. The set of paths in the original JSON
|
* attributes give to the builder. The set of paths in the original JSON
|
||||||
* is replaced with a list of `PathInfo` in JSON format.
|
* is replaced with a list of `PathInfo` in JSON format.
|
||||||
*/
|
*/
|
||||||
std::map<std::string, StringSet> exportReferencesGraph;
|
std::map<std::string, std::set<Input>> exportReferencesGraph;
|
||||||
|
|
||||||
/**
|
|
||||||
* Once a derivations is resolved, the strings in in
|
|
||||||
* `exportReferencesGraph` should all be store paths (with possible
|
|
||||||
* suffix paths, but those are discarded).
|
|
||||||
*
|
|
||||||
* @return The parsed path set for for each key in the map.
|
|
||||||
*
|
|
||||||
* @todo Ideally, `exportReferencesGraph` would just store
|
|
||||||
* `StorePath`s for this, but we can't just do that, because for CA
|
|
||||||
* derivations they is actually in general `DerivedPath`s (via
|
|
||||||
* placeholder strings) until the derivation is resolved and exact
|
|
||||||
* inputs store paths are known. We can use better types for that
|
|
||||||
* too, but that is a longer project.
|
|
||||||
*/
|
|
||||||
std::map<std::string, StorePathSet> getParsedExportReferencesGraph(const StoreDirConfig & store) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* env: __sandboxProfile
|
* env: __sandboxProfile
|
||||||
|
|
@ -185,18 +176,6 @@ struct DerivationOptions
|
||||||
|
|
||||||
bool operator==(const DerivationOptions &) const = default;
|
bool operator==(const DerivationOptions &) const = default;
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse this information from its legacy encoding as part of the
|
|
||||||
* environment. This should not be used with nice greenfield formats
|
|
||||||
* (e.g. JSON) but is necessary for supporting old formats (e.g.
|
|
||||||
* ATerm).
|
|
||||||
*/
|
|
||||||
static DerivationOptions
|
|
||||||
fromStructuredAttrs(const StringMap & env, const StructuredAttrs * parsed, bool shouldWarn = true);
|
|
||||||
|
|
||||||
static DerivationOptions
|
|
||||||
fromStructuredAttrs(const StringMap & env, const std::optional<StructuredAttrs> & parsed, bool shouldWarn = true);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param drv Must be the same derivation we parsed this from. In
|
* @param drv Must be the same derivation we parsed this from. In
|
||||||
* the future we'll flip things around so a `BasicDerivation` has
|
* the future we'll flip things around so a `BasicDerivation` has
|
||||||
|
|
@ -222,7 +201,62 @@ struct DerivationOptions
|
||||||
bool useUidRange(const BasicDerivation & drv) const;
|
bool useUidRange(const BasicDerivation & drv) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern template struct DerivationOptions<StorePath>;
|
||||||
|
extern template struct DerivationOptions<SingleDerivedPath>;
|
||||||
|
|
||||||
|
struct DerivationOutput;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse this information from its legacy encoding as part of the
|
||||||
|
* environment. This should not be used with nice greenfield formats
|
||||||
|
* (e.g. JSON) but is necessary for supporting old formats (e.g.
|
||||||
|
* ATerm).
|
||||||
|
*/
|
||||||
|
DerivationOptions<SingleDerivedPath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const DerivedPathMap<StringSet> & inputDrvs,
|
||||||
|
const StringMap & env,
|
||||||
|
const StructuredAttrs * parsed,
|
||||||
|
bool shouldWarn = true,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
|
DerivationOptions<SingleDerivedPath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const DerivedPathMap<StringSet> & inputDrvs,
|
||||||
|
const StringMap & env,
|
||||||
|
const std::optional<StructuredAttrs> & parsed,
|
||||||
|
bool shouldWarn = true,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
|
DerivationOptions<StorePath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const StringMap & env,
|
||||||
|
const StructuredAttrs * parsed,
|
||||||
|
bool shouldWarn = true,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
|
DerivationOptions<StorePath> derivationOptionsFromStructuredAttrs(
|
||||||
|
const StoreDirConfig & store,
|
||||||
|
const StringMap & env,
|
||||||
|
const std::optional<StructuredAttrs> & parsed,
|
||||||
|
bool shouldWarn = true,
|
||||||
|
const ExperimentalFeatureSettings & mockXpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
|
std::optional<DerivationOptions<StorePath>> tryResolve(
|
||||||
|
const DerivationOptions<SingleDerivedPath> & drvOptions,
|
||||||
|
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
||||||
|
queryResolutionChain);
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct json_avoids_null;
|
||||||
|
|
||||||
|
template<typename Input>
|
||||||
|
struct json_avoids_null<DerivationOptions<Input>> : std::true_type
|
||||||
|
{};
|
||||||
|
|
||||||
}; // namespace nix
|
}; // namespace nix
|
||||||
|
|
||||||
JSON_IMPL(DerivationOptions);
|
JSON_IMPL(nix::DerivationOptions<nix::StorePath>);
|
||||||
JSON_IMPL(DerivationOptions::OutputChecks)
|
JSON_IMPL(nix::DerivationOptions<nix::SingleDerivedPath>);
|
||||||
|
JSON_IMPL(nix::DerivationOptions<nix::StorePath>::OutputChecks)
|
||||||
|
JSON_IMPL(nix::DerivationOptions<nix::SingleDerivedPath>::OutputChecks)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include "nix/util/repair-flag.hh"
|
#include "nix/util/repair-flag.hh"
|
||||||
#include "nix/store/derived-path-map.hh"
|
#include "nix/store/derived-path-map.hh"
|
||||||
#include "nix/store/parsed-derivations.hh"
|
#include "nix/store/parsed-derivations.hh"
|
||||||
|
#include "nix/store/derivation-options.hh"
|
||||||
#include "nix/util/sync.hh"
|
#include "nix/util/sync.hh"
|
||||||
#include "nix/util/variant-wrapper.hh"
|
#include "nix/util/variant-wrapper.hh"
|
||||||
|
|
||||||
|
|
@ -332,6 +333,16 @@ struct Derivation : BasicDerivation
|
||||||
*/
|
*/
|
||||||
DerivedPathMap<std::set<OutputName, std::less<>>> inputDrvs;
|
DerivedPathMap<std::set<OutputName, std::less<>>> inputDrvs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derivation options
|
||||||
|
*
|
||||||
|
* @todo instead of `BasicDerivation`/`Derivation`, should just have
|
||||||
|
* `template<...> Derivation`, and then the choice of template
|
||||||
|
* parameter would control "possibly-unresolved vs definitely
|
||||||
|
* resolved" and this field would use the overall type parameter.
|
||||||
|
*/
|
||||||
|
DerivationOptions<SingleDerivedPath> options;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a derivation.
|
* Print a derivation.
|
||||||
*/
|
*/
|
||||||
|
|
@ -349,14 +360,15 @@ struct Derivation : BasicDerivation
|
||||||
* 2. Input placeholders are replaced with realized input store
|
* 2. Input placeholders are replaced with realized input store
|
||||||
* paths.
|
* paths.
|
||||||
*/
|
*/
|
||||||
std::optional<BasicDerivation> tryResolve(Store & store, Store * evalStore = nullptr) const;
|
std::optional<std::pair<BasicDerivation, DerivationOptions<StorePath>>>
|
||||||
|
tryResolve(Store & store, Store * evalStore = nullptr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like the above, but instead of querying the Nix database for
|
* Like the above, but instead of querying the Nix database for
|
||||||
* realisations, uses a given mapping from input derivation paths +
|
* realisations, uses a given mapping from input derivation paths +
|
||||||
* output names to actual output store paths.
|
* output names to actual output store paths.
|
||||||
*/
|
*/
|
||||||
std::optional<BasicDerivation> tryResolve(
|
std::optional<std::pair<BasicDerivation, DerivationOptions<StorePath>>> tryResolve(
|
||||||
Store & store,
|
Store & store,
|
||||||
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
std::function<std::optional<StorePath>(ref<const SingleDerivedPath> drvPath, const std::string & outputName)>
|
||||||
queryResolutionChain) const;
|
queryResolutionChain) const;
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,23 @@
|
||||||
///@file
|
///@file
|
||||||
|
|
||||||
#include "nix/util/hash.hh"
|
#include "nix/util/hash.hh"
|
||||||
|
#include "nix/util/json-impls.hh"
|
||||||
#include "nix/store/path.hh"
|
#include "nix/store/path.hh"
|
||||||
#include "nix/store/derived-path.hh"
|
#include "nix/store/derived-path.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reference is either to a to-be-registered output (by name),
|
||||||
|
* or to an already-registered store object (by `Input`).
|
||||||
|
*
|
||||||
|
* `Ref<SingleDerivedPath` is a representation of something that can be
|
||||||
|
* turned into a placeholder. (Regular own-output placeholder in the
|
||||||
|
* first case, `DownstreamPlaceholder` in the second case.)
|
||||||
|
*/
|
||||||
|
template<typename Input>
|
||||||
|
using DrvRef = std::variant<OutputName, Input>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downstream Placeholders are opaque and almost certainly unique values
|
* Downstream Placeholders are opaque and almost certainly unique values
|
||||||
* used to allow derivations to refer to store objects which are yet to
|
* used to allow derivations to refer to store objects which are yet to
|
||||||
|
|
@ -92,3 +104,17 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
||||||
|
namespace nlohmann {
|
||||||
|
|
||||||
|
template<typename Item>
|
||||||
|
struct adl_serializer<nix::DrvRef<Item>>
|
||||||
|
{
|
||||||
|
static nix::DrvRef<Item> from_json(const json & json);
|
||||||
|
static void to_json(json & json, const nix::DrvRef<Item> & t);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern template struct adl_serializer<nix::DrvRef<nix::StorePath>>;
|
||||||
|
extern template struct adl_serializer<nix::DrvRef<nix::SingleDerivedPath>>;
|
||||||
|
|
||||||
|
} // namespace nlohmann
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
class Store;
|
class Store;
|
||||||
|
template<typename Input>
|
||||||
struct DerivationOptions;
|
struct DerivationOptions;
|
||||||
struct DerivationOutput;
|
struct DerivationOutput;
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ struct StructuredAttrs
|
||||||
|
|
||||||
nlohmann::json::object_t prepareStructuredAttrs(
|
nlohmann::json::object_t prepareStructuredAttrs(
|
||||||
Store & store,
|
Store & store,
|
||||||
const DerivationOptions & drvOptions,
|
const DerivationOptions<StorePath> & drvOptions,
|
||||||
const StorePathSet & inputPaths,
|
const StorePathSet & inputPaths,
|
||||||
const DerivationOutputs & outputs) const;
|
const DerivationOutputs & outputs) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,17 +224,8 @@ MissingPaths Store::queryMissing(const std::vector<DerivedPath> & targets)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto drv = make_ref<Derivation>(derivationFromPath(drvPath));
|
auto drv = make_ref<Derivation>(derivationFromPath(drvPath));
|
||||||
DerivationOptions drvOptions;
|
|
||||||
try {
|
|
||||||
// FIXME: this is a lot of work just to get the value
|
|
||||||
// of `allowSubstitutes`.
|
|
||||||
drvOptions = DerivationOptions::fromStructuredAttrs(drv->env, drv->structuredAttrs);
|
|
||||||
} catch (Error & e) {
|
|
||||||
e.addTrace({}, "while parsing derivation '%s'", printStorePath(drvPath));
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!knownOutputPaths && settings.useSubstitutes && drvOptions.substitutesAllowed()) {
|
if (!knownOutputPaths && settings.useSubstitutes && drv->options.substitutesAllowed()) {
|
||||||
experimentalFeatureSettings.require(Xp::CaDerivations);
|
experimentalFeatureSettings.require(Xp::CaDerivations);
|
||||||
|
|
||||||
// If there are unknown output paths, attempt to find if the
|
// If there are unknown output paths, attempt to find if the
|
||||||
|
|
@ -264,7 +255,7 @@ MissingPaths Store::queryMissing(const std::vector<DerivedPath> & targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (knownOutputPaths && settings.useSubstitutes && drvOptions.substitutesAllowed()) {
|
if (knownOutputPaths && settings.useSubstitutes && drv->options.substitutesAllowed()) {
|
||||||
auto drvState = make_ref<Sync<DrvState>>(DrvState(invalid.size()));
|
auto drvState = make_ref<Sync<DrvState>>(DrvState(invalid.size()));
|
||||||
for (auto & output : invalid)
|
for (auto & output : invalid)
|
||||||
pool.enqueue(std::bind(checkOutput, drvPath, drv, output, drvState));
|
pool.enqueue(std::bind(checkOutput, drvPath, drv, output, drvState));
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ static nlohmann::json pathInfoToJSON(Store & store, const StorePathSet & storePa
|
||||||
|
|
||||||
nlohmann::json::object_t StructuredAttrs::prepareStructuredAttrs(
|
nlohmann::json::object_t StructuredAttrs::prepareStructuredAttrs(
|
||||||
Store & store,
|
Store & store,
|
||||||
const DerivationOptions & drvOptions,
|
const DerivationOptions<StorePath> & drvOptions,
|
||||||
const StorePathSet & inputPaths,
|
const StorePathSet & inputPaths,
|
||||||
const DerivationOutputs & outputs) const
|
const DerivationOutputs & outputs) const
|
||||||
{
|
{
|
||||||
|
|
@ -114,8 +114,8 @@ nlohmann::json::object_t StructuredAttrs::prepareStructuredAttrs(
|
||||||
json["outputs"] = std::move(outputsJson);
|
json["outputs"] = std::move(outputsJson);
|
||||||
|
|
||||||
/* Handle exportReferencesGraph. */
|
/* Handle exportReferencesGraph. */
|
||||||
for (auto & [key, storePaths] : drvOptions.getParsedExportReferencesGraph(store)) {
|
for (auto & [key, storePaths] : drvOptions.exportReferencesGraph) {
|
||||||
json[key] = pathInfoToJSON(store, store.exportReferences(storePaths, storePaths));
|
json[key] = pathInfoToJSON(store, store.exportReferences(storePaths, inputPaths));
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
|
|
||||||
|
|
@ -1169,8 +1169,10 @@ std::optional<StorePath> Store::getBuildDerivationPath(const StorePath & path)
|
||||||
// The build log is actually attached to the corresponding
|
// The build log is actually attached to the corresponding
|
||||||
// resolved derivation, so we need to get it first
|
// resolved derivation, so we need to get it first
|
||||||
auto resolvedDrv = drv.tryResolve(*this);
|
auto resolvedDrv = drv.tryResolve(*this);
|
||||||
if (resolvedDrv)
|
if (resolvedDrv) {
|
||||||
return ::nix::writeDerivation(*this, *resolvedDrv, NoRepair, true);
|
// TODO check options compatibility with ATerm.
|
||||||
|
return ::nix::writeDerivation(*this, resolvedDrv->first, NoRepair, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
|
||||||
|
|
@ -532,9 +532,9 @@ static void main_nix_build(int argc, char ** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
|
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
|
||||||
auto resolvedDrv = drv.tryResolve(*store);
|
auto resolved = drv.tryResolve(*store);
|
||||||
assert(resolvedDrv && "Successfully resolved the derivation");
|
assert(resolved && "Successfully resolved the derivation");
|
||||||
drv = *resolvedDrv;
|
drv = resolved->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the environment.
|
// Set the environment.
|
||||||
|
|
@ -554,18 +554,10 @@ static void main_nix_build(int argc, char ** argv)
|
||||||
env["NIX_STORE"] = store->storeDir;
|
env["NIX_STORE"] = store->storeDir;
|
||||||
env["NIX_BUILD_CORES"] = fmt("%d", settings.buildCores ? settings.buildCores : settings.getDefaultCores());
|
env["NIX_BUILD_CORES"] = fmt("%d", settings.buildCores ? settings.buildCores : settings.getDefaultCores());
|
||||||
|
|
||||||
DerivationOptions drvOptions;
|
|
||||||
try {
|
|
||||||
drvOptions = DerivationOptions::fromStructuredAttrs(drv.env, drv.structuredAttrs);
|
|
||||||
} catch (Error & e) {
|
|
||||||
e.addTrace({}, "while parsing derivation '%s'", store->printStorePath(packageInfo.requireDrvPath()));
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fileNr = 0;
|
int fileNr = 0;
|
||||||
|
|
||||||
for (auto & var : drv.env)
|
for (auto & var : drv.env)
|
||||||
if (drvOptions.passAsFile.count(var.first)) {
|
if (drv.options.passAsFile.count(var.first)) {
|
||||||
auto fn = ".attr-" + std::to_string(fileNr++);
|
auto fn = ".attr-" + std::to_string(fileNr++);
|
||||||
Path p = (tmpDir.path() / fn).string();
|
Path p = (tmpDir.path() / fn).string();
|
||||||
writeFile(p, var.second);
|
writeFile(p, var.second);
|
||||||
|
|
@ -594,7 +586,7 @@ static void main_nix_build(int argc, char ** argv)
|
||||||
for (const auto & [inputDrv, inputNode] : drv.inputDrvs.map)
|
for (const auto & [inputDrv, inputNode] : drv.inputDrvs.map)
|
||||||
accumInputClosure(inputDrv, inputNode);
|
accumInputClosure(inputDrv, inputNode);
|
||||||
|
|
||||||
auto json = drv.structuredAttrs->prepareStructuredAttrs(*store, drvOptions, inputs, drv.outputs);
|
auto json = drv.structuredAttrs->prepareStructuredAttrs(*store, drv.options, inputs, drv.outputs);
|
||||||
|
|
||||||
structuredAttrsRC = StructuredAttrs::writeShell(json);
|
structuredAttrsRC = StructuredAttrs::writeShell(json);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,5 +64,5 @@ fi
|
||||||
if isDaemonNewer "2.28pre20241225"; then
|
if isDaemonNewer "2.28pre20241225"; then
|
||||||
# test12 should fail (syntactically invalid).
|
# test12 should fail (syntactically invalid).
|
||||||
expectStderr 1 nix-build -vvv -o "$RESULT" check-refs.nix -A test12 >"$TEST_ROOT/test12.stderr"
|
expectStderr 1 nix-build -vvv -o "$RESULT" check-refs.nix -A test12 >"$TEST_ROOT/test12.stderr"
|
||||||
grepQuiet -F "output check for 'lib' contains an illegal reference specifier 'dev', expected store path or output name (one of [lib, out])" < "$TEST_ROOT/test12.stderr"
|
grepQuiet -F "output check for 'lib' contains output name 'dev', but this is not a valid output of this derivation. (Valid outputs are [lib, out].)" < "$TEST_ROOT/test12.stderr"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,16 @@ derivation' {
|
||||||
outputChecks = {
|
outputChecks = {
|
||||||
out = {
|
out = {
|
||||||
allowedReferences = [ foo ];
|
allowedReferences = [ foo ];
|
||||||
allowedRequisites = [ foo.dev ];
|
allowedRequisites = [
|
||||||
|
foo.dev
|
||||||
|
"bin"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
bin = {
|
bin = {
|
||||||
disallowedReferences = [ bar ];
|
disallowedReferences = [
|
||||||
|
bar
|
||||||
|
"dev"
|
||||||
|
];
|
||||||
disallowedRequisites = [ bar.dev ];
|
disallowedRequisites = [ bar.dev ];
|
||||||
};
|
};
|
||||||
dev = {
|
dev = {
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,14 @@ derivation' {
|
||||||
impureEnvVars = [ "UNICORN" ];
|
impureEnvVars = [ "UNICORN" ];
|
||||||
__darwinAllowLocalNetworking = true;
|
__darwinAllowLocalNetworking = true;
|
||||||
allowedReferences = [ foo ];
|
allowedReferences = [ foo ];
|
||||||
allowedRequisites = [ foo.dev ];
|
allowedRequisites = [
|
||||||
disallowedReferences = [ bar ];
|
foo.dev
|
||||||
|
"bin"
|
||||||
|
];
|
||||||
|
disallowedReferences = [
|
||||||
|
bar
|
||||||
|
"dev"
|
||||||
|
];
|
||||||
disallowedRequisites = [ bar.dev ];
|
disallowedRequisites = [ bar.dev ];
|
||||||
requiredSystemFeatures = [
|
requiredSystemFeatures = [
|
||||||
"rainbow"
|
"rainbow"
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Derive([("bin","","r:sha256",""),("dev","","r:sha256",""),("out","","r:sha256","")],[("/nix/store/j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",["dev","out"]),("/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",["dev","out"])],["/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"__darwinAllowLocalNetworking\":true,\"__impureHostDeps\":[\"/usr/bin/ditto\"],\"__noChroot\":true,\"__sandboxProfile\":\"sandcastle\",\"allowSubstitutes\":false,\"builder\":\"/bin/bash\",\"exportReferencesGraph\":{\"refs1\":[\"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9\"],\"refs2\":[\"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv\"]},\"impureEnvVars\":[\"UNICORN\"],\"name\":\"advanced-attributes-structured-attrs\",\"outputChecks\":{\"bin\":{\"disallowedReferences\":[\"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g\"],\"disallowedRequisites\":[\"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8\"]},\"dev\":{\"maxClosureSize\":5909,\"maxSize\":789},\"out\":{\"allowedReferences\":[\"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9\"],\"allowedRequisites\":[\"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z\"]}},\"outputHashAlgo\":\"sha256\",\"outputHashMode\":\"recursive\",\"outputs\":[\"out\",\"bin\",\"dev\"],\"preferLocalBuild\":true,\"requiredSystemFeatures\":[\"rainbow\",\"uid-range\"],\"system\":\"my-system\"}"),("bin","/04f3da1kmbr67m3gzxikmsl4vjz5zf777sv6m14ahv22r65aac9m"),("dev","/02qcpld1y6xhs5gz9bchpxaw0xdhmsp5dv88lh25r2ss44kh8dxz"),("out","/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9")])
|
Derive([("bin","","r:sha256",""),("dev","","r:sha256",""),("out","","r:sha256","")],[("/nix/store/j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",["dev","out"]),("/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",["dev","out"])],["/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"__darwinAllowLocalNetworking\":true,\"__impureHostDeps\":[\"/usr/bin/ditto\"],\"__noChroot\":true,\"__sandboxProfile\":\"sandcastle\",\"allowSubstitutes\":false,\"builder\":\"/bin/bash\",\"exportReferencesGraph\":{\"refs1\":[\"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9\"],\"refs2\":[\"/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv\"]},\"impureEnvVars\":[\"UNICORN\"],\"name\":\"advanced-attributes-structured-attrs\",\"outputChecks\":{\"bin\":{\"disallowedReferences\":[\"/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g\",\"dev\"],\"disallowedRequisites\":[\"/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8\"]},\"dev\":{\"maxClosureSize\":5909,\"maxSize\":789},\"out\":{\"allowedReferences\":[\"/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9\"],\"allowedRequisites\":[\"/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z\",\"bin\"]}},\"outputHashAlgo\":\"sha256\",\"outputHashMode\":\"recursive\",\"outputs\":[\"out\",\"bin\",\"dev\"],\"preferLocalBuild\":true,\"requiredSystemFeatures\":[\"rainbow\",\"uid-range\"],\"system\":\"my-system\"}"),("bin","/04f3da1kmbr67m3gzxikmsl4vjz5zf777sv6m14ahv22r65aac9m"),("dev","/02qcpld1y6xhs5gz9bchpxaw0xdhmsp5dv88lh25r2ss44kh8dxz"),("out","/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9")])
|
||||||
|
|
@ -1 +1 @@
|
||||||
Derive([("out","","r:sha256","")],[("/nix/store/j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",["dev","out"]),("/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",["dev","out"])],["/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__darwinAllowLocalNetworking","1"),("__impureHostDeps","/usr/bin/ditto"),("__noChroot","1"),("__sandboxProfile","sandcastle"),("allowSubstitutes",""),("allowedReferences","/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"),("allowedRequisites","/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z"),("builder","/bin/bash"),("disallowedReferences","/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g"),("disallowedRequisites","/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"),("exportReferencesGraph","refs1 /164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9 refs2 /nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"),("impureEnvVars","UNICORN"),("name","advanced-attributes"),("out","/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9"),("outputHashAlgo","sha256"),("outputHashMode","recursive"),("preferLocalBuild","1"),("requiredSystemFeatures","rainbow uid-range"),("system","my-system")])
|
Derive([("out","","r:sha256","")],[("/nix/store/j56sf12rxpcv5swr14vsjn5cwm6bj03h-foo.drv",["dev","out"]),("/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv",["dev","out"])],["/nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__darwinAllowLocalNetworking","1"),("__impureHostDeps","/usr/bin/ditto"),("__noChroot","1"),("__sandboxProfile","sandcastle"),("allowSubstitutes",""),("allowedReferences","/164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9"),("allowedRequisites","/0nr45p69vn6izw9446wsh9bng9nndhvn19kpsm4n96a5mycw0s4z bin"),("builder","/bin/bash"),("disallowedReferences","/0nyw57wm2iicnm9rglvjmbci3ikmcp823czdqdzdcgsnnwqps71g dev"),("disallowedRequisites","/07f301yqyz8c6wf6bbbavb2q39j4n8kmcly1s09xadyhgy6x2wr8"),("exportReferencesGraph","refs1 /164j69y6zir9z0339n8pjigg3rckinlr77bxsavzizdaaljb7nh9 refs2 /nix/store/qnml92yh97a6fbrs2m5qg5cqlc8vni58-bar.drv"),("impureEnvVars","UNICORN"),("name","advanced-attributes"),("out","/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9"),("outputHashAlgo","sha256"),("outputHashMode","recursive"),("preferLocalBuild","1"),("requiredSystemFeatures","rainbow uid-range"),("system","my-system")])
|
||||||
|
|
@ -1 +1 @@
|
||||||
Derive([("bin","/nix/store/33qms3h55wlaspzba3brlzlrm8m2239g-advanced-attributes-structured-attrs-bin","",""),("dev","/nix/store/wyfgwsdi8rs851wmy1xfzdxy7y5vrg5l-advanced-attributes-structured-attrs-dev","",""),("out","/nix/store/7cxy4zx1vqc885r4jl2l64pymqbdmhii-advanced-attributes-structured-attrs","","")],[("/nix/store/afc3vbjbzql750v2lp8gxgaxsajphzih-foo.drv",["dev","out"]),("/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",["dev","out"])],["/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"__darwinAllowLocalNetworking\":true,\"__impureHostDeps\":[\"/usr/bin/ditto\"],\"__noChroot\":true,\"__sandboxProfile\":\"sandcastle\",\"allowSubstitutes\":false,\"builder\":\"/bin/bash\",\"exportReferencesGraph\":{\"refs1\":[\"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo\"],\"refs2\":[\"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv\"]},\"impureEnvVars\":[\"UNICORN\"],\"name\":\"advanced-attributes-structured-attrs\",\"outputChecks\":{\"bin\":{\"disallowedReferences\":[\"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar\"],\"disallowedRequisites\":[\"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev\"]},\"dev\":{\"maxClosureSize\":5909,\"maxSize\":789},\"out\":{\"allowedReferences\":[\"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo\"],\"allowedRequisites\":[\"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev\"]}},\"outputs\":[\"out\",\"bin\",\"dev\"],\"preferLocalBuild\":true,\"requiredSystemFeatures\":[\"rainbow\",\"uid-range\"],\"system\":\"my-system\"}"),("bin","/nix/store/33qms3h55wlaspzba3brlzlrm8m2239g-advanced-attributes-structured-attrs-bin"),("dev","/nix/store/wyfgwsdi8rs851wmy1xfzdxy7y5vrg5l-advanced-attributes-structured-attrs-dev"),("out","/nix/store/7cxy4zx1vqc885r4jl2l64pymqbdmhii-advanced-attributes-structured-attrs")])
|
Derive([("bin","/nix/store/cnpasdljgkhnwaf78cf3qygcp4qbki1c-advanced-attributes-structured-attrs-bin","",""),("dev","/nix/store/ijq6mwpa9jbnpnl33qldfqihrr38kprx-advanced-attributes-structured-attrs-dev","",""),("out","/nix/store/h1vh648d3p088kdimy0r8ngpfx7c3nzw-advanced-attributes-structured-attrs","","")],[("/nix/store/afc3vbjbzql750v2lp8gxgaxsajphzih-foo.drv",["dev","out"]),("/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",["dev","out"])],["/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__json","{\"__darwinAllowLocalNetworking\":true,\"__impureHostDeps\":[\"/usr/bin/ditto\"],\"__noChroot\":true,\"__sandboxProfile\":\"sandcastle\",\"allowSubstitutes\":false,\"builder\":\"/bin/bash\",\"exportReferencesGraph\":{\"refs1\":[\"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo\"],\"refs2\":[\"/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv\"]},\"impureEnvVars\":[\"UNICORN\"],\"name\":\"advanced-attributes-structured-attrs\",\"outputChecks\":{\"bin\":{\"disallowedReferences\":[\"/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar\",\"dev\"],\"disallowedRequisites\":[\"/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev\"]},\"dev\":{\"maxClosureSize\":5909,\"maxSize\":789},\"out\":{\"allowedReferences\":[\"/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo\"],\"allowedRequisites\":[\"/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev\",\"bin\"]}},\"outputs\":[\"out\",\"bin\",\"dev\"],\"preferLocalBuild\":true,\"requiredSystemFeatures\":[\"rainbow\",\"uid-range\"],\"system\":\"my-system\"}"),("bin","/nix/store/cnpasdljgkhnwaf78cf3qygcp4qbki1c-advanced-attributes-structured-attrs-bin"),("dev","/nix/store/ijq6mwpa9jbnpnl33qldfqihrr38kprx-advanced-attributes-structured-attrs-dev"),("out","/nix/store/h1vh648d3p088kdimy0r8ngpfx7c3nzw-advanced-attributes-structured-attrs")])
|
||||||
|
|
@ -1 +1 @@
|
||||||
Derive([("out","/nix/store/wyhpwd748pns4k7svh48wdrc8kvjk0ra-advanced-attributes","","")],[("/nix/store/afc3vbjbzql750v2lp8gxgaxsajphzih-foo.drv",["dev","out"]),("/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",["dev","out"])],["/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__darwinAllowLocalNetworking","1"),("__impureHostDeps","/usr/bin/ditto"),("__noChroot","1"),("__sandboxProfile","sandcastle"),("allowSubstitutes",""),("allowedReferences","/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"),("allowedRequisites","/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev"),("builder","/bin/bash"),("disallowedReferences","/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar"),("disallowedRequisites","/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"),("exportReferencesGraph","refs1 /nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo refs2 /nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"),("impureEnvVars","UNICORN"),("name","advanced-attributes"),("out","/nix/store/wyhpwd748pns4k7svh48wdrc8kvjk0ra-advanced-attributes"),("preferLocalBuild","1"),("requiredSystemFeatures","rainbow uid-range"),("system","my-system")])
|
Derive([("out","/nix/store/ymqmybkq5j4nd1xplw6ccdpbjnfi017v-advanced-attributes","","")],[("/nix/store/afc3vbjbzql750v2lp8gxgaxsajphzih-foo.drv",["dev","out"]),("/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv",["dev","out"])],["/nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"],"my-system","/bin/bash",["-c","echo hello > $out"],[("__darwinAllowLocalNetworking","1"),("__impureHostDeps","/usr/bin/ditto"),("__noChroot","1"),("__sandboxProfile","sandcastle"),("allowSubstitutes",""),("allowedReferences","/nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo"),("allowedRequisites","/nix/store/z0rjzy29v9k5qa4nqpykrbzirj7sd43v-foo-dev bin"),("builder","/bin/bash"),("disallowedReferences","/nix/store/r5cff30838majxk5mp3ip2diffi8vpaj-bar dev"),("disallowedRequisites","/nix/store/9b61w26b4avv870dw0ymb6rw4r1hzpws-bar-dev"),("exportReferencesGraph","refs1 /nix/store/p0hax2lzvjpfc2gwkk62xdglz0fcqfzn-foo refs2 /nix/store/vj2i49jm2868j2fmqvxm70vlzmzvgv14-bar.drv"),("impureEnvVars","UNICORN"),("name","advanced-attributes"),("out","/nix/store/ymqmybkq5j4nd1xplw6ccdpbjnfi017v-advanced-attributes"),("preferLocalBuild","1"),("requiredSystemFeatures","rainbow uid-range"),("system","my-system")])
|
||||||
|
|
@ -4,3 +4,9 @@ warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs'
|
||||||
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'disallowedRequisites'; use 'outputChecks.<output>.disallowedRequisites' instead
|
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'disallowedRequisites'; use 'outputChecks.<output>.disallowedRequisites' instead
|
||||||
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'maxClosureSize'; use 'outputChecks.<output>.maxClosureSize' instead
|
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'maxClosureSize'; use 'outputChecks.<output>.maxClosureSize' instead
|
||||||
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'maxSize'; use 'outputChecks.<output>.maxSize' instead
|
warning: In a derivation named 'eval-okay-derivation-legacy', 'structuredAttrs' disables the effect of the derivation attribute 'maxSize'; use 'outputChecks.<output>.maxSize' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'allowedReferences'; use 'outputChecks' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'allowedRequisites'; use 'outputChecks' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'disallowedRequisites'; use 'outputChecks' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'disallowedReferences'; use 'outputChecks' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'maxSize'; use 'outputChecks' instead
|
||||||
|
warning: 'structuredAttrs' disables the effect of the top-level attribute 'maxClosureSize'; use 'outputChecks' instead
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue