From 1f19ce7a912dd22f038ba3103c2c0615c330f577 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 20 May 2024 21:53:33 -0600 Subject: [PATCH] fix(home-manager): remove xdg.enable assertions (#181) --- modules/home-manager/btop.nix | 4 ---- modules/home-manager/fcitx5.nix | 12 +++--------- modules/home-manager/fish.nix | 9 ++------- modules/home-manager/gtk.nix | 10 +++------- modules/home-manager/k9s.nix | 4 ---- modules/home-manager/micro.nix | 4 ---- modules/home-manager/yazi.nix | 9 ++------- modules/lib/default.nix | 5 ----- 8 files changed, 10 insertions(+), 47 deletions(-) diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index d034ffd3..1d67e94f 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -17,10 +17,6 @@ in config = lib.mkIf enable { - assertions = [ - (lib.ctp.assertXdgEnabled "btop") - ]; - xdg.configFile."btop${themePath}".source = theme; programs.btop.settings.color_theme = themeFile; diff --git a/modules/home-manager/fcitx5.nix b/modules/home-manager/fcitx5.nix index 7fcf95dc..7fd18b78 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -3,14 +3,12 @@ , ... }: let - inherit (lib) ctp; inherit (config.catppuccin) sources; - cfg = config.i18n.inputMethod.fcitx5.catppuccin; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; in { - options.i18n.inputMethod.fcitx5.catppuccin = ctp.mkCatppuccinOpt "Fcitx5" // { + options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt "Fcitx5" // { apply = lib.mkOption { type = lib.types.bool; default = true; @@ -22,19 +20,15 @@ in }; config = lib.mkIf enable { - assertions = [ - (ctp.assertXdgEnabled "Fcitx5") - ]; - xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavour}" = { source = "${sources.fcitx5}/src/catppuccin-${cfg.flavour}"; recursive = true; }; - xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply ({ + xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply { text = lib.generators.toINIWithGlobalSection { } { globalSection.Theme = "catppuccin-${cfg.flavour}"; }; - }); + }; }; } diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index 52187acd..262dc7af 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -3,22 +3,17 @@ , ... }: let - inherit (lib) ctp mkIf; inherit (config.catppuccin) sources; cfg = config.programs.fish.catppuccin; enable = cfg.enable && config.programs.fish.enable; - themeName = "Catppuccin ${ctp.mkUpper cfg.flavour}"; + themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavour}"; themePath = "/themes/${themeName}.theme"; in { options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish"; - config = mkIf enable { - assertions = [ - (lib.ctp.assertXdgEnabled "fish") - ]; - + config = lib.mkIf enable { xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; programs.fish.shellInit = '' diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index 85abecea..29c4994e 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -8,7 +8,7 @@ let cfg = config.gtk.catppuccin; enable = cfg.enable && config.gtk.enable; # "dark" and "light" can be used alongside the regular accents - cursorAccentType = ctp.mergeEnums (ctp.types.accentOption) (lib.types.enum [ "dark" "light" ]); + cursorAccentType = ctp.mergeEnums ctp.types.accentOption (lib.types.enum [ "dark" "light" ]); in { options.gtk.catppuccin = @@ -39,10 +39,6 @@ in }; config = lib.mkIf enable { - assertions = [ - (ctp.assertXdgEnabled "gtk") - ]; - gtk = { theme = let @@ -87,7 +83,7 @@ in name = "Papirus-${polarity}"; package = pkgs.catppuccin-papirus-folders.override { flavor = cfg.icon.flavour; - accent = cfg.icon.accent; + inherit (cfg.icon) accent; }; }; }; @@ -112,7 +108,7 @@ in ]; }; "org/gnome/shell/extensions/user-theme" = { - name = config.gtk.theme.name; + inherit (config.gtk.theme) name; }; "org/gnome/desktop/interface" = { color-scheme = diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index 3f1080e9..4c247464 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -23,10 +23,6 @@ in config = lib.mkIf enable { - assertions = [ - (lib.ctp.assertXdgEnabled "k9s") - ]; - xdg.configFile."k9s${themePath}".source = theme; programs.k9s.settings.k9s.ui.skin = themeName; diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index 9d20bd5d..eb878c19 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -14,10 +14,6 @@ in lib.ctp.mkCatppuccinOpt "micro"; config = lib.mkIf enable { - assertions = [ - (lib.ctp.assertXdgEnabled "micro") - ]; - programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; xdg.configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}"; diff --git a/modules/home-manager/yazi.nix b/modules/home-manager/yazi.nix index 839c9cf4..172bae58 100644 --- a/modules/home-manager/yazi.nix +++ b/modules/home-manager/yazi.nix @@ -3,7 +3,6 @@ , ... }: let - inherit (lib) ctp; inherit (config.catppuccin) sources; cfg = config.programs.yazi.catppuccin; @@ -11,14 +10,10 @@ let in { options.programs.yazi.catppuccin = - ctp.mkCatppuccinOpt "yazi"; + lib.ctp.mkCatppuccinOpt "yazi"; config = lib.mkIf enable { - assertions = [ - (lib.ctp.assertXdgEnabled "yazi") - ]; - programs.yazi.theme = lib.importTOML "${sources.yazi}/themes/${cfg.flavour}.toml"; - xdg.configFile."yazi/Catppuccin-${cfg.flavour}.tmTheme".source = "${sources.bat}/themes/Catppuccin ${ctp.mkUpper cfg.flavour}.tmTheme"; + xdg.configFile."yazi/Catppuccin-${cfg.flavour}.tmTheme".source = "${sources.bat}/themes/Catppuccin ${lib.ctp.mkUpper cfg.flavour}.tmTheme"; }; } diff --git a/modules/lib/default.nix b/modules/lib/default.nix index c7843c95..7e98fa55 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -111,11 +111,6 @@ in # followed by the local config attrset mkAccentOpt = ctp.mkBasicOpt "accent" ctp.types.accentOption; - assertXdgEnabled = name: { - assertion = config.xdg.enable; - message = "Option xdg.enable must be enabled to apply Catppuccin theming for ${name}"; - }; - # a -> a -> a # see https://nlewo.github.io/nixos-manual-sphinx/development/option-types.xml.html # by default enums cannot be merged, but they keep their passed value in `functor.payload`.