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
c82e52b0d9
commit
c7ce343d9b
|
@ -28,28 +28,34 @@ let
|
||||||
specialArgs = { modulesPath = builtins.toString ./.; } // extraSpecialArgs;
|
specialArgs = { modulesPath = builtins.toString ./.; } // extraSpecialArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
module = showWarnings (let
|
moduleChecks = raw:
|
||||||
failed = collectFailed rawModule.config;
|
showWarnings (let
|
||||||
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
failed = collectFailed raw.config;
|
||||||
in if failed == [ ] then
|
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
|
||||||
rawModule
|
in if failed == [ ] then
|
||||||
else
|
raw
|
||||||
throw ''
|
else
|
||||||
|
throw ''
|
||||||
|
|
||||||
Failed assertions:
|
Failed assertions:
|
||||||
${failedStr}'');
|
${failedStr}'');
|
||||||
|
|
||||||
in {
|
withExtraAttrs = rawModule:
|
||||||
inherit (module) options config;
|
let module = moduleChecks rawModule;
|
||||||
|
in {
|
||||||
|
inherit (module) options config;
|
||||||
|
|
||||||
activationPackage = module.config.home.activationPackage;
|
activationPackage = module.config.home.activationPackage;
|
||||||
|
|
||||||
# For backwards compatibility. Please use activationPackage instead.
|
# For backwards compatibility. Please use activationPackage instead.
|
||||||
activation-script = module.config.home.activationPackage;
|
activation-script = module.config.home.activationPackage;
|
||||||
|
|
||||||
newsDisplay = rawModule.config.news.display;
|
newsDisplay = rawModule.config.news.display;
|
||||||
newsEntries = sort (a: b: a.time > b.time)
|
newsEntries = sort (a: b: a.time > b.time)
|
||||||
(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