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.
This commit is contained in:
Matt Sturgeon 2024-09-20 09:11:32 +01:00
parent 5e5abe8ff4
commit 1bd4da1848
No known key found for this signature in database
GPG Key ID: 4F91844CED1A8299
2 changed files with 16 additions and 1 deletions

View File

@ -386,7 +386,7 @@ in
`nixpkgs.config` options should be passed when creating the instance instead.
Current value:
${lib.generators.toPretty { multiline = true; } opt.config}
${lib.generators.toPretty { multiline = true; } cfg.config}
'';
}
];

View File

@ -16,6 +16,10 @@ let
nixpkgs.hostPlatform = "aarch64-linux";
nixpkgs.buildPlatform = "aarch64-linux";
};
externalPkgsWithConfig = {
nixpkgs.pkgs = pkgs;
nixpkgs.config.allowUnfree = true;
};
ambiguous = {
_file = "ambiguous.nix";
nixpkgs.hostPlatform = "aarch64-linux";
@ -108,6 +112,17 @@ lib.recurseIntoAttrs {
For a future proof system configuration, we recommend to remove
the legacy definitions.
''];
assert builtins.trace (lib.head (getErrors externalPkgsWithConfig))
getErrors externalPkgsWithConfig ==
[''
Your system configures nixpkgs with an externally created instance.
`nixpkgs.config` options should be passed when creating the instance instead.
Current value:
{
allowUnfree = true;
}
''];
assert getErrors {
nixpkgs.localSystem = pkgs.stdenv.hostPlatform;
nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform;