diff options
author | Robert Helgesson <robert@rycee.net> | 2020-01-16 23:41:14 +0100 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-01-21 20:47:04 +0100 |
commit | 6e4b9af0803ac00e94398768c5d19d2e423b0be9 (patch) | |
tree | 65f117f6a8b562348eaf12469dadb084af2be417 /nix-darwin | |
parent | c8323a0bf16acf2c9d89ce164568089017d19668 (diff) |
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
Diffstat (limited to 'nix-darwin')
-rw-r--r-- | nix-darwin/default.nix | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 1482c7bb245..24f042a7f0b 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -6,17 +6,27 @@ let cfg = config.home-manager; - hmModule = types.submodule ({name, ...}: { - imports = import ../modules/modules.nix { inherit lib pkgs; }; + extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib; - config = { - submoduleSupport.enable = true; - submoduleSupport.externalPackageInstall = cfg.useUserPackages; + hmModule = types.submoduleWith { + specialArgs = { lib = extendedLib; }; + modules = [( + {name, ...}: { + imports = import ../modules/modules.nix { + inherit pkgs; + lib = extendedLib; + }; - home.username = config.users.users.${name}.name; - home.homeDirectory = config.users.users.${name}.home; - }; - }); + config = { + submoduleSupport.enable = true; + submoduleSupport.externalPackageInstall = cfg.useUserPackages; + + home.username = config.users.users.${name}.name; + home.homeDirectory = config.users.users.${name}.home; + }; + } + )]; + }; in |