mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 09:01:04 +01:00
Switch to extended Nixpkg's lib
This change makes use of the `extend` function inside `lib` to inject a new `hm` field containing the Home Manager library functions. This simplifies use of the Home Manager library in the modules and reduces the risk of accidental infinite recursion. PR #994
This commit is contained in:
parent
c8323a0bf1
commit
6e4b9af080
19 changed files with 136 additions and 75 deletions
|
|
@ -1,18 +1,20 @@
|
|||
{ pkgs }:
|
||||
{
|
||||
# Note, this should be "the standard library" + HM extensions.
|
||||
lib
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
lib = pkgs.lib;
|
||||
|
||||
nmdSrc = pkgs.fetchFromGitLab {
|
||||
name = "nmd";
|
||||
owner = "rycee";
|
||||
repo = "nmd";
|
||||
rev = "9751ca5ef6eb2ef27470010208d4c0a20e89443d";
|
||||
sha256 = "0rbx10n8kk0bvp1nl5c8q79lz1w0p1b8103asbvwps3gmqd070hi";
|
||||
rev = "b437898c2b137c39d9c5f9a1cf62ec630f14d9fc";
|
||||
sha256 = "18j1nh53cfpjpdiwn99x9kqpvr0s7hwngyc0a93xf4sg88ww93lq";
|
||||
};
|
||||
|
||||
nmd = import nmdSrc { inherit pkgs; };
|
||||
nmd = import nmdSrc { inherit lib pkgs; };
|
||||
|
||||
# Make sure the used package is scrubbed to avoid actually
|
||||
# instantiating derivations.
|
||||
|
|
@ -29,7 +31,10 @@ let
|
|||
|
||||
hmModulesDocs = nmd.buildModulesDocs {
|
||||
modules =
|
||||
import ../modules/modules.nix { inherit lib pkgs; }
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
check = false;
|
||||
}
|
||||
++ [ scrubbedPkgsModule ];
|
||||
moduleRootPaths = [ ./.. ];
|
||||
mkModuleUrl = path:
|
||||
|
|
|
|||
|
|
@ -36,6 +36,39 @@ home.file = {
|
|||
Support for the list form will be removed in Home Manager version
|
||||
20.09.
|
||||
|
||||
* The `lib` function attribute given to modules is now enriched with
|
||||
an attribute `hm` containing extra library functions specific for Home
|
||||
Manager. More specifically, `lib.hm` is now the same as `config.lib`
|
||||
and should be the preferred choice since it is more robust.
|
||||
+
|
||||
Therefore, if your configuration makes use of, for example,
|
||||
`config.lib.dag` to create activation script blocks, it is recommended
|
||||
to change to `lib.hm.dag`.
|
||||
+
|
||||
Note, in the unlikely case that you are
|
||||
+
|
||||
** using Home Manager's NixOS or nix-darwin module,
|
||||
** have made your own Home Manager module containing an top-level
|
||||
option named `config` or `options`, and
|
||||
** assign to this option in your system configuration inside a plain
|
||||
attribute set, i.e., without a function argument,
|
||||
|
||||
+
|
||||
then you must update your configuration to perform the option
|
||||
assignment inside a `config` attribute. For example, instead of
|
||||
+
|
||||
[source,nix]
|
||||
----
|
||||
home-manager.users.jane = { config = "foo"; };
|
||||
----
|
||||
+
|
||||
use
|
||||
+
|
||||
[source,nix]
|
||||
----
|
||||
home-manager.users.jane = { config.config = "foo"; };
|
||||
----
|
||||
|
||||
[[sec-release-20.03-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue