diff --git a/doc/release-notes/rl-2009.adoc b/doc/release-notes/rl-2009.adoc index 7657033f1..7740646a9 100644 --- a/doc/release-notes/rl-2009.adoc +++ b/doc/release-notes/rl-2009.adoc @@ -45,3 +45,10 @@ will automatically include these options, when necessary. -- * Git's `smtpEncryption` option is now set to `tls` only if both <> and <> are `true`. If only <> is `true`, `ssl` is used instead. + +* The `nixpkgs` module no longer references ``. Before it would do so when building the `pkgs` module argument. Starting with state version 20.09, the `pkgs` argument is instead built from the same Nixpkgs that was used to initialize the Home Manager modules. This is useful, for example, when using Home Manager within a Nix Flake. If you want to keep using `` with state version ≥ 20.09 then add ++ +[source,nix] +_module.args.pkgsPath = ; ++ +to your Home Manager configuration. diff --git a/modules/misc/nixpkgs.nix b/modules/misc/nixpkgs.nix index 7b0904a5f..511dbec10 100644 --- a/modules/misc/nixpkgs.nix +++ b/modules/misc/nixpkgs.nix @@ -1,6 +1,6 @@ # Adapted from Nixpkgs. -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, pkgsPath, ... }: with lib; @@ -49,7 +49,7 @@ let merge = lib.mergeOneOption; }; - _pkgs = import ( + _pkgs = import pkgsPath ( filterAttrs (n: v: v != null) config.nixpkgs ); diff --git a/modules/modules.nix b/modules/modules.nix index 1744b4fd0..fa9c7f38c 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -197,9 +197,14 @@ let modules = map (getAttr "file") (filter (getAttr "condition") allModules); - pkgsModule = { + pkgsModule = { config, ... }: { config = { _module.args.baseModules = modules; + _module.args.pkgsPath = lib.mkDefault ( + if versionAtLeast config.home.stateVersion "20.09" then + pkgs.path + else + ); _module.args.pkgs = lib.mkDefault pkgs; _module.check = check; lib = lib.hm;