mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08: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:
@@ -6,22 +6,32 @@ 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;
|
||||
};
|
||||
|
||||
# The per-user directory inside /etc/profiles is not known by
|
||||
# fontconfig by default.
|
||||
fonts.fontconfig.enable =
|
||||
cfg.useUserPackages && config.fonts.fontconfig.enable;
|
||||
config = {
|
||||
submoduleSupport.enable = true;
|
||||
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
|
||||
|
||||
home.username = config.users.users.${name}.name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
};
|
||||
});
|
||||
# The per-user directory inside /etc/profiles is not known by
|
||||
# fontconfig by default.
|
||||
fonts.fontconfig.enable =
|
||||
cfg.useUserPackages && config.fonts.fontconfig.enable;
|
||||
|
||||
home.username = config.users.users.${name}.name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
};
|
||||
}
|
||||
)];
|
||||
};
|
||||
|
||||
serviceEnvironment =
|
||||
optionalAttrs (cfg.backupFileExtension != null) {
|
||||
|
||||
Reference in New Issue
Block a user