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: homeManagerModule: {
{ lib, config, options, ... }: lib,
config,
let options,
copyModules = builtins.map ...
}: let
copyModules =
builtins.map
( (
{ path, condition ? lib.const true }: {
{ config, osConfig, ... }: path,
condition ? lib.const true,
}: {
config,
osConfig,
...
}:
lib.mkIf (condition config) lib.mkIf (condition config)
(lib.setAttrByPath path (lib.mkDefault (lib.getAttrFromPath path osConfig))) (lib.setAttrByPath path (lib.mkDefault (lib.getAttrFromPath path osConfig)))
) )
@ -37,9 +46,10 @@ let
path = ["stylix" "override"]; path = ["stylix" "override"];
condition = homeConfig: config.stylix.base16Scheme == homeConfig.stylix.base16Scheme; 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 { in {
options.stylix.homeManagerIntegration = { options.stylix.homeManagerIntegration = {
followSystem = lib.mkOption { followSystem = lib.mkOption {
@ -73,7 +83,7 @@ in {
lib.optionalAttrs (options ? home-manager) lib.optionalAttrs (options ? home-manager)
(lib.mkIf config.stylix.homeManagerIntegration.autoImport { (lib.mkIf config.stylix.homeManagerIntegration.autoImport {
home-manager.sharedModules = home-manager.sharedModules =
[ homeManagerModule ] ++ [homeManagerModule]
(lib.optionals config.stylix.homeManagerIntegration.followSystem copyModules); ++ (lib.optionals config.stylix.homeManagerIntegration.followSystem copyModules);
}); });
} }