Describe the bug
According to the docs the various references / requisites checks can be given "by output" via outputChecks once __structuredAttrs are enabled.
But it's entirely unclear that this also disables the regular checks for all outputs. It's reasonable to assume that those would still work for all outputs.
Steps To Reproduce
Given this file:
{ pkgs ? import <nixpkgs> {} }:
let
dep = pkgs.stdenv.mkDerivation {
name = "dependency";
buildCommand = "mkdir $out; echo foo > $out/bar";
};
test1 = pkgs.stdenv.mkDerivation {
name = "test-output-checks";
__structuredAttrs = true;
buildCommand = "mkdir $out; ln -s ${dep} $out/link";
outputChecks.out.allowedReferences = [];
};
test2 = pkgs.stdenv.mkDerivation {
name = "test-allowed-references";
buildCommand = "mkdir $out; ln -s ${dep} $out/link";
allowedReferences = [];
};
test3 = pkgs.stdenv.mkDerivation {
name = "test-structured-allowed-references";
__structuredAttrs = true;
buildCommand = "mkdir $out; ln -s ${dep} $out/link";
allowedReferences = [];
};
in {
inherit test1 test2 test3;
}
run
% nix-build structured-references.nix -A test1 -A test2 -A test3 --keep-going
these 3 derivations will be built:
/nix/store/1164xlarcgl97liwl9vm86q8kw2wljzi-test-allowed-references.drv
/nix/store/2l3mg2jkaqhlfcjz7vbqgh6cjhqn1mzl-test-output-checks.drv
/nix/store/9xwsdpb35d384hgqsj1l2q2mck1lz6rw-test-structured-allowed-references.drv
building '/nix/store/1164xlarcgl97liwl9vm86q8kw2wljzi-test-allowed-references.drv'...
building '/nix/store/2l3mg2jkaqhlfcjz7vbqgh6cjhqn1mzl-test-output-checks.drv'...
structuredAttrs is enabled
building '/nix/store/9xwsdpb35d384hgqsj1l2q2mck1lz6rw-test-structured-allowed-references.drv'...
structuredAttrs is enabled
error: output '/nix/store/8zmyi2kis8shacj4z662v9ikqd9vg72a-test-output-checks' is not allowed to refer to the following paths:
/nix/store/avxn8b8a71zf5lacgmay3sa7d0llsnbi-dependency
error: output '/nix/store/vr5fbmwjg1r2dca3vgavcdqwph7sj67k-test-allowed-references' is not allowed to refer to the following paths:
/nix/store/avxn8b8a71zf5lacgmay3sa7d0llsnbi-dependency
error: build of '/nix/store/1164xlarcgl97liwl9vm86q8kw2wljzi-test-allowed-references.drv', '/nix/store/2l3mg2jkaqhlfcjz7vbqgh6cjhqn1mzl-test-output-checks.drv' failed
Note that test-structured-allowed-references did not fail, but it should.
Expected behavior
Top-level allowedReferences, disallowedReferences, allowedRequisites and disallowedRequisites should continue to work when __structuredAttrs is set.
Alternatively, this should be pointed out clearly in the docs.
nix-env --version output
Describe the bug
According to the docs the various references / requisites checks can be given "by output" via
outputChecksonce__structuredAttrsare enabled.But it's entirely unclear that this also disables the regular checks for all outputs. It's reasonable to assume that those would still work for all outputs.
Steps To Reproduce
Given this file:
run
Note that
test-structured-allowed-referencesdid not fail, but it should.Expected behavior
Top-level
allowedReferences,disallowedReferences,allowedRequisitesanddisallowedRequisitesshould continue to work when__structuredAttrsis set.Alternatively, this should be pointed out clearly in the docs.
nix-env --versionoutput