mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 15:14:26 +00:00
nixpkgs: take Nixpkgs path from argument
This removes the dependency on the `nixpkgs` channel within the modules for state version ≥ 20.09. The default Nixpkgs source starting from this state version is the path of the `pkgs` argument used to bootstrap the Home Manager modeuls. This is a prerequisite for using Home Manager withing Nix flakes. PR #1420
This commit is contained in:
parent
a3dd580adc
commit
9854342b9f
3 changed files with 15 additions and 3 deletions
|
@ -45,3 +45,10 @@ will automatically include these options, when necessary.
|
|||
--
|
||||
|
||||
* Git's `smtpEncryption` option is now set to `tls` only if both <<opt-accounts.email.accounts.\_name_.smtp.tls.enable>> and <<opt-accounts.email.accounts.\_name_.smtp.tls.useStartTls>> are `true`. If only <<opt-accounts.email.accounts.\_name_.smtp.tls.enable>> is `true`, `ssl` is used instead.
|
||||
|
||||
* The `nixpkgs` module no longer references `<nixpkgs>`. 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 `<nixpkgs>` with state version ≥ 20.09 then add
|
||||
+
|
||||
[source,nix]
|
||||
_module.args.pkgsPath = <nixpkgs>;
|
||||
+
|
||||
to your Home Manager configuration.
|
||||
|
|
|
@ -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 <nixpkgs> (
|
||||
_pkgs = import pkgsPath (
|
||||
filterAttrs (n: v: v != null) config.nixpkgs
|
||||
);
|
||||
|
||||
|
|
|
@ -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
|
||||
<nixpkgs>);
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
_module.check = check;
|
||||
lib = lib.hm;
|
||||
|
|
Loading…
Reference in a new issue