From 6e4b9af0803ac00e94398768c5d19d2e423b0be9 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 16 Jan 2020 23:41:14 +0100 Subject: 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 --- doc/default.nix | 19 ++++++++++++------- doc/release-notes/rl-2003.adoc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/default.nix b/doc/default.nix index acfa1f1e49c..97c1914a571 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -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: diff --git a/doc/release-notes/rl-2003.adoc b/doc/release-notes/rl-2003.adoc index 29024205610..fc1dcd7cfe2 100644 --- a/doc/release-notes/rl-2003.adoc +++ b/doc/release-notes/rl-2003.adoc @@ -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 -- cgit v1.2.3