mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +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,6 +1,6 @@
|
|||
{ lib }:
|
||||
|
||||
{
|
||||
rec {
|
||||
dag =
|
||||
let
|
||||
d = import ./dag.nix { inherit lib; };
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
};
|
||||
|
||||
strings = import ./strings.nix { inherit lib; };
|
||||
types = import ./types.nix { inherit dag lib; };
|
||||
|
||||
shell = import ./shell.nix { inherit lib; };
|
||||
zsh = import ./zsh.nix { inherit lib; };
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
stringsExtra = import ./strings.nix { inherit lib; };
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
# Constructs a type suitable for a `home.file` like option. The
|
||||
# target path may be either absolute or relative, in which case it
|
||||
|
|
@ -93,7 +87,7 @@ in
|
|||
source = mkIf (config.text != null) (
|
||||
mkDefault (pkgs.writeTextFile {
|
||||
inherit (config) executable text;
|
||||
name = stringsExtra.storeFileName name;
|
||||
name = hm.strings.storeFileName name;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
|
|
|||
11
modules/lib/stdlib-extended.nix
Normal file
11
modules/lib/stdlib-extended.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Just a convenience function that returns the given Nixpkgs standard
|
||||
# library extended with the HM library.
|
||||
|
||||
nixpkgsLib:
|
||||
|
||||
let
|
||||
mkHmLib = import ./.;
|
||||
in
|
||||
nixpkgsLib.extend (self: super: {
|
||||
hm = mkHmLib { lib = super; };
|
||||
})
|
||||
|
|
@ -4,7 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
hmLib = import ./default.nix { inherit lib; };
|
||||
typesDag = import ./types-dag.nix { inherit dag lib; };
|
||||
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue