Skip to content

Commit d12ed10

Browse files
authored
nixos/nixpkgs: fix assertion text & show def files (#343212)
2 parents ab60645 + 6d9dfef commit d12ed10

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

nixos/modules/misc/nixpkgs.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,10 @@ in
386386
`nixpkgs.config` options should be passed when creating the instance instead.
387387
388388
Current value:
389-
${lib.generators.toPretty { multiline = true; } opt.config}
389+
${lib.generators.toPretty { multiline = true; } cfg.config}
390+
391+
Defined in:
392+
${lib.concatMapStringsSep "\n" (file: " - ${file}") opt.config.files}
390393
'';
391394
}
392395
];

nixos/modules/misc/nixpkgs/test.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ let
1616
nixpkgs.hostPlatform = "aarch64-linux";
1717
nixpkgs.buildPlatform = "aarch64-linux";
1818
};
19+
externalPkgsWithConfig = {
20+
_file = "ext-pkgs-config.nix";
21+
nixpkgs.pkgs = pkgs;
22+
nixpkgs.config.allowUnfree = true;
23+
};
1924
ambiguous = {
2025
_file = "ambiguous.nix";
2126
nixpkgs.hostPlatform = "aarch64-linux";
@@ -108,6 +113,20 @@ lib.recurseIntoAttrs {
108113
For a future proof system configuration, we recommend to remove
109114
the legacy definitions.
110115
''];
116+
assert builtins.trace (lib.head (getErrors externalPkgsWithConfig))
117+
getErrors externalPkgsWithConfig ==
118+
[''
119+
Your system configures nixpkgs with an externally created instance.
120+
`nixpkgs.config` options should be passed when creating the instance instead.
121+
122+
Current value:
123+
{
124+
allowUnfree = true;
125+
}
126+
127+
Defined in:
128+
- ext-pkgs-config.nix
129+
''];
111130
assert getErrors {
112131
nixpkgs.localSystem = pkgs.stdenv.hostPlatform;
113132
nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform;

0 commit comments

Comments
 (0)