From b0a3a9a52f0ac9bef834a3e45d511776afe95aad Mon Sep 17 00:00:00 2001 From: Gavin John Date: Fri, 13 Dec 2024 21:51:49 -0800 Subject: [PATCH] nixos/lib/eval-config: Add warning when masking pkgs --- nixos/lib/eval-config.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 8bab3752073f..ad028013f65f 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -65,6 +65,14 @@ let withWarnings = x: lib.warnIf (evalConfigArgs?extraArgs) "The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead." lib.warnIf (evalConfigArgs?check) "The check argument to eval-config.nix is deprecated. Please set config._module.check instead." + lib.warnIf (specialArgs?pkgs) '' + You have set specialArgs.pkgs, which means that options like nixpkgs.config + and nixpkgs.overlays will be ignored. If you wish to reuse an already created + pkgs, which you know is configured correctly for this NixOS configuration, + please import the `nixosModules.pkgsReadOnly` module from the nixpkgs flake or + `(modulesPath + "/misc/nixpkgs/read-only.nix"), and set `{ nixpkgs.pkgs = ; }`. + This properly disables the ignored options to prevent future surprises. + '' x; legacyModules =