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

View File

@ -1,45 +1,55 @@
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)))
) )
[ [
{ path = [ "stylix" "autoEnable" ]; } {path = ["stylix" "autoEnable"];}
{ {
path = [ "stylix" "base16Scheme" ]; path = ["stylix" "base16Scheme"];
condition = homeConfig: config.stylix.image == homeConfig.stylix.image; condition = homeConfig: config.stylix.image == homeConfig.stylix.image;
} }
{ path = [ "stylix" "cursor" "name" ]; } {path = ["stylix" "cursor" "name"];}
{ path = [ "stylix" "cursor" "package" ]; } {path = ["stylix" "cursor" "package"];}
{ path = [ "stylix" "cursor" "size" ]; } {path = ["stylix" "cursor" "size"];}
{ path = [ "stylix" "enable" ]; } {path = ["stylix" "enable"];}
{ path = [ "stylix" "fonts" "serif" ]; } {path = ["stylix" "fonts" "serif"];}
{ path = [ "stylix" "fonts" "sansSerif" ]; } {path = ["stylix" "fonts" "sansSerif"];}
{ path = [ "stylix" "fonts" "monospace" ]; } {path = ["stylix" "fonts" "monospace"];}
{ path = [ "stylix" "fonts" "emoji" ]; } {path = ["stylix" "fonts" "emoji"];}
{ path = [ "stylix" "fonts" "sizes" "desktop" ]; } {path = ["stylix" "fonts" "sizes" "desktop"];}
{ path = [ "stylix" "fonts" "sizes" "applications" ]; } {path = ["stylix" "fonts" "sizes" "applications"];}
{ path = [ "stylix" "fonts" "sizes" "terminal" ]; } {path = ["stylix" "fonts" "sizes" "terminal"];}
{ path = [ "stylix" "fonts" "sizes" "popups" ]; } {path = ["stylix" "fonts" "sizes" "popups"];}
{ path = [ "stylix" "image" ]; } {path = ["stylix" "image"];}
{ path = [ "stylix" "imageScalingMode" ]; } {path = ["stylix" "imageScalingMode"];}
{ path = [ "stylix" "opacity" "desktop" ]; } {path = ["stylix" "opacity" "desktop"];}
{ path = [ "stylix" "opacity" "applications" ]; } {path = ["stylix" "opacity" "applications"];}
{ path = [ "stylix" "opacity" "terminal" ]; } {path = ["stylix" "opacity" "terminal"];}
{ path = [ "stylix" "opacity" "popups" ]; } {path = ["stylix" "opacity" "popups"];}
{ {
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);
}); });
} }