diff --git a/home/hosts/work/default.nix b/home/hosts/work/default.nix index 8e331c24..fe8f2535 100644 --- a/home/hosts/work/default.nix +++ b/home/hosts/work/default.nix @@ -90,6 +90,7 @@ redis.enable = true; }; k8s.enable = true; + my.stylix.enable = true; git.github.enable = true; git.gitlab.enable = true; secrets.vault.enable = true; diff --git a/home/modules/stylix/default.nix b/home/modules/stylix/default.nix index 46a483b4..ea8658be 100644 --- a/home/modules/stylix/default.nix +++ b/home/modules/stylix/default.nix @@ -1,30 +1,36 @@ { config, + lib, inputs, pkgs, ... }: let + cfg = config.my.stylix; theme = import ../../../modules/stylix/theme.nix { inherit pkgs; }; in { imports = [ inputs.stylix.homeModules.stylix ]; - stylix = { - enable = true; - inherit (theme) - polarity - base16Scheme - override - image - ; - fonts = { - monospace = theme.monospaceFont; - serif = config.stylix.fonts.monospace; - sansSerif = config.stylix.fonts.monospace; - emoji = config.stylix.fonts.monospace; + options.my.stylix.enable = lib.mkEnableOption "stylix"; + + config = lib.mkIf cfg.enable { + stylix = { + enable = true; + inherit (theme) + polarity + base16Scheme + override + image + ; + fonts = { + monospace = theme.monospaceFont; + serif = config.stylix.fonts.monospace; + sansSerif = config.stylix.fonts.monospace; + emoji = config.stylix.fonts.monospace; + }; + targets = import ../../../modules/stylix/targets.nix; }; - targets = import ../../../modules/stylix/targets.nix; }; } diff --git a/modules/stylix/default.nix b/modules/stylix/default.nix index be763836..ee459b56 100644 --- a/modules/stylix/default.nix +++ b/modules/stylix/default.nix @@ -1,36 +1,42 @@ { config, inputs, + lib, pkgs, ... }: let + cfg = config.my.stylix; theme = import ./theme.nix { inherit pkgs; }; in { imports = [ inputs.stylix.nixosModules.stylix ]; - stylix = { - enable = true; - inherit (theme) - polarity - base16Scheme - override - image - ; - fonts = { - monospace = theme.monospaceFont; - serif = config.stylix.fonts.monospace; - sansSerif = config.stylix.fonts.monospace; - emoji = config.stylix.fonts.monospace; - }; - autoEnable = true; - }; + options.my.stylix.enable = lib.mkEnableOption "stylix theming"; - home-manager.sharedModules = [ - { - stylix.targets = import ./targets.nix; - } - ]; + config = lib.mkIf cfg.enable { + stylix = { + enable = true; + inherit (theme) + polarity + base16Scheme + override + image + ; + fonts = { + monospace = theme.monospaceFont; + serif = config.stylix.fonts.monospace; + sansSerif = config.stylix.fonts.monospace; + emoji = config.stylix.fonts.monospace; + }; + autoEnable = true; + }; + + home-manager.sharedModules = [ + { + stylix.targets = import ./targets.nix; + } + ]; + }; }