mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 11:19:47 +01:00
home-manager: add extendModules attribute
The `home-manager.lib.homeManagerConfiguration` function now has an additional attribute that can be used to extend a Home Manager configuration with additional modules outside the project tree. It works similar to the result of `lib.nixosSystem` from Nixpkgs
This commit is contained in:
parent
3249809b33
commit
17b2a3a2a7
1 changed files with 25 additions and 19 deletions
|
@ -28,17 +28,20 @@ let
|
||||||
specialArgs = { modulesPath = builtins.toString ./.; } // extraSpecialArgs;
|
specialArgs = { modulesPath = builtins.toString ./.; } // extraSpecialArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = showWarnings (let
|
moduleChecks = raw:
|
||||||
failed = collectFailed rawModule.config;
|
showWarnings (let
|
||||||
|
failed = collectFailed raw.config;
|
||||||
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
||||||
in if failed == [ ] then
|
in if failed == [ ] then
|
||||||
rawModule
|
raw
|
||||||
else
|
else
|
||||||
throw ''
|
throw ''
|
||||||
|
|
||||||
Failed assertions:
|
Failed assertions:
|
||||||
${failedStr}'');
|
${failedStr}'');
|
||||||
|
|
||||||
|
withExtraAttrs = rawModule:
|
||||||
|
let module = moduleChecks rawModule;
|
||||||
in {
|
in {
|
||||||
inherit (module) options config;
|
inherit (module) options config;
|
||||||
|
|
||||||
|
@ -52,4 +55,7 @@ in {
|
||||||
(filter (a: a.condition) rawModule.config.news.entries);
|
(filter (a: a.condition) rawModule.config.news.entries);
|
||||||
|
|
||||||
inherit (module._module.args) pkgs;
|
inherit (module._module.args) pkgs;
|
||||||
}
|
|
||||||
|
extendModules = args: withExtraAttrs (rawModule.extendModules args);
|
||||||
|
};
|
||||||
|
in withExtraAttrs rawModule
|
||||||
|
|
Loading…
Reference in a new issue