summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2024-09-20 11:53:58 +0200
committerGitHub <noreply@github.com>2024-09-20 11:53:58 +0200
commitd12ed107be67ebe7faa765c2060c33ffe52b6bb9 (patch)
treee90a6622c67f574606f9dfaf905df591a68954c8
parentcoq.autosubst: 1.8 -> 1.9 (diff)
parentnixos/nixpkgs: show definition files in `config` assertion (diff)
downloadnixpkgs-d12ed107be67ebe7faa765c2060c33ffe52b6bb9.tar.gz
nixos/nixpkgs: fix assertion text & show def files (#343212)
-rw-r--r--nixos/modules/misc/nixpkgs.nix5
-rw-r--r--nixos/modules/misc/nixpkgs/test.nix19
2 files changed, 23 insertions, 1 deletions
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 44903a15c5ca..4048fd685737 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -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}
'';
}
];
diff --git a/nixos/modules/misc/nixpkgs/test.nix b/nixos/modules/misc/nixpkgs/test.nix
index be9a88a07788..e70b7a12e8dd 100644
--- a/nixos/modules/misc/nixpkgs/test.nix
+++ b/nixos/modules/misc/nixpkgs/test.nix
@@ -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";
@@ -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;