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:
{ lib, config, options, ... }:
let
copyModules = builtins.map
homeManagerModule: {
lib,
config,
options,
...
}: let
copyModules =
builtins.map
(
{ path, condition ? lib.const true }:
{ config, osConfig, ... }:
lib.mkIf (condition config)
(lib.setAttrByPath path (lib.mkDefault (lib.getAttrFromPath path osConfig)))
{
path,
condition ? lib.const true,
}: {
config,
osConfig,
...
}:
lib.mkIf (condition config)
(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;
}
{ path = [ "stylix" "cursor" "name" ]; }
{ path = [ "stylix" "cursor" "package" ]; }
{ path = [ "stylix" "cursor" "size" ]; }
{ path = [ "stylix" "enable" ]; }
{ path = [ "stylix" "fonts" "serif" ]; }
{ path = [ "stylix" "fonts" "sansSerif" ]; }
{ path = [ "stylix" "fonts" "monospace" ]; }
{ path = [ "stylix" "fonts" "emoji" ]; }
{ path = [ "stylix" "fonts" "sizes" "desktop" ]; }
{ path = [ "stylix" "fonts" "sizes" "applications" ]; }
{ path = [ "stylix" "fonts" "sizes" "terminal" ]; }
{ path = [ "stylix" "fonts" "sizes" "popups" ]; }
{ path = [ "stylix" "image" ]; }
{ path = [ "stylix" "imageScalingMode" ]; }
{ path = [ "stylix" "opacity" "desktop" ]; }
{ path = [ "stylix" "opacity" "applications" ]; }
{ path = [ "stylix" "opacity" "terminal" ]; }
{ path = [ "stylix" "opacity" "popups" ]; }
{path = ["stylix" "cursor" "name"];}
{path = ["stylix" "cursor" "package"];}
{path = ["stylix" "cursor" "size"];}
{path = ["stylix" "enable"];}
{path = ["stylix" "fonts" "serif"];}
{path = ["stylix" "fonts" "sansSerif"];}
{path = ["stylix" "fonts" "monospace"];}
{path = ["stylix" "fonts" "emoji"];}
{path = ["stylix" "fonts" "sizes" "desktop"];}
{path = ["stylix" "fonts" "sizes" "applications"];}
{path = ["stylix" "fonts" "sizes" "terminal"];}
{path = ["stylix" "fonts" "sizes" "popups"];}
{path = ["stylix" "image"];}
{path = ["stylix" "imageScalingMode"];}
{path = ["stylix" "opacity" "desktop"];}
{path = ["stylix" "opacity" "applications"];}
{path = ["stylix" "opacity" "terminal"];}
{path = ["stylix" "opacity" "popups"];}
{
path = [ "stylix" "override" ];
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);
});
}