Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/nixpkgs: fix assertion text & show def files #343212

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion nixos/modules/misc/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ 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}

Defined in:
${lib.concatMapStringsSep "\n" (file: " - ${file}") opt.config.files}
'';
}
];
Expand Down
19 changes: 19 additions & 0 deletions nixos/modules/misc/nixpkgs/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ let
nixpkgs.hostPlatform = "aarch64-linux";
nixpkgs.buildPlatform = "aarch64-linux";
};
externalPkgsWithConfig = {
_file = "ext-pkgs-config.nix";
nixpkgs.pkgs = pkgs;
nixpkgs.config.allowUnfree = true;
};
ambiguous = {
_file = "ambiguous.nix";
nixpkgs.hostPlatform = "aarch64-linux";
Expand Down Expand Up @@ -108,6 +113,20 @@ 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;
}

Defined in:
- ext-pkgs-config.nix
''];
assert getErrors {
nixpkgs.localSystem = pkgs.stdenv.hostPlatform;
nixpkgs.hostPlatform = pkgs.stdenv.hostPlatform;
Expand Down