Skip to content

Commit 1bd4da1

Browse files
committed
nixos/nixpkgs: fix config assertion text
The assertion message should include the `nixpkgs.config` value, however it currently includes the entire `nixpkgs.config` _option_. This means the type, declarations, definitions, etc were all printed.
1 parent 5e5abe8 commit 1bd4da1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

nixos/modules/misc/nixpkgs.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ 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}
390390
'';
391391
}
392392
];

nixos/modules/misc/nixpkgs/test.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ let
1616
nixpkgs.hostPlatform = "aarch64-linux";
1717
nixpkgs.buildPlatform = "aarch64-linux";
1818
};
19+
externalPkgsWithConfig = {
20+
nixpkgs.pkgs = pkgs;
21+
nixpkgs.config.allowUnfree = true;
22+
};
1923
ambiguous = {
2024
_file = "ambiguous.nix";
2125
nixpkgs.hostPlatform = "aarch64-linux";
@@ -108,6 +112,17 @@ lib.recurseIntoAttrs {
108112
For a future proof system configuration, we recommend to remove
109113
the legacy definitions.
110114
''];
115+
assert builtins.trace (lib.head (getErrors externalPkgsWithConfig))
116+
getErrors externalPkgsWithConfig ==
117+
[''
118+
Your system configures nixpkgs with an externally created instance.
119+
`nixpkgs.config` options should be passed when creating the instance instead.
120+
121+
Current value:
122+
{
123+
allowUnfree = true;
124+
}
125+
''];
111126
assert getErrors {
112127
nixpkgs.localSystem = pkgs.stdenv.hostPlatform;
113128
nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform;

0 commit comments

Comments
 (0)