This commit is contained in:
Louis Dalibard 2024-12-24 16:15:14 +01:00
parent 546eb76bd1
commit 1301fa3071

View File

@ -1,11 +1,20 @@
homeManagerModule:
{ lib, config, options, ... }:
let
copyModules = builtins.map
homeManagerModule: {
lib,
config,
options,
...
}: let
copyModules =
builtins.map
(
{ path, condition ? lib.const true }:
{ config, osConfig, ... }:
{
path,
condition ? lib.const true,
}: {
config,
osConfig,
...
}:
lib.mkIf (condition config)
(lib.setAttrByPath path (lib.mkDefault (lib.getAttrFromPath path osConfig)))
)
@ -37,9 +46,10 @@ let
path = ["stylix" "override"];
condition = homeConfig: config.stylix.base16Scheme == homeConfig.stylix.base16Scheme;
}
{ path = [ "stylix" "polarity" ]; }
{path = ["stylix" "polarity" "force"];}
{path = ["stylix" "polarity" "primaryScale" "dark"];}
{path = ["stylix" "polarity" "primaryScale" "light"];}
];
in {
options.stylix.homeManagerIntegration = {
followSystem = lib.mkOption {
@ -73,7 +83,7 @@ in {
lib.optionalAttrs (options ? home-manager)
(lib.mkIf config.stylix.homeManagerIntegration.autoImport {
home-manager.sharedModules =
[ homeManagerModule ] ++
(lib.optionals config.stylix.homeManagerIntegration.followSystem copyModules);
[homeManagerModule]
++ (lib.optionals config.stylix.homeManagerIntegration.followSystem copyModules);
});
}