fix(home-manager): remove xdg.enable assertions (#181)

This commit is contained in:
seth 2024-05-20 21:53:33 -06:00 committed by GitHub
parent 9999d33b51
commit 1f19ce7a91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 10 additions and 47 deletions

View file

@ -17,10 +17,6 @@ in
config = lib.mkIf enable config = lib.mkIf enable
{ {
assertions = [
(lib.ctp.assertXdgEnabled "btop")
];
xdg.configFile."btop${themePath}".source = theme; xdg.configFile."btop${themePath}".source = theme;
programs.btop.settings.color_theme = themeFile; programs.btop.settings.color_theme = themeFile;

View file

@ -3,14 +3,12 @@
, ... , ...
}: }:
let let
inherit (lib) ctp;
inherit (config.catppuccin) sources; inherit (config.catppuccin) sources;
cfg = config.i18n.inputMethod.fcitx5.catppuccin; cfg = config.i18n.inputMethod.fcitx5.catppuccin;
enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5";
in in
{ {
options.i18n.inputMethod.fcitx5.catppuccin = ctp.mkCatppuccinOpt "Fcitx5" // { options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt "Fcitx5" // {
apply = lib.mkOption { apply = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
@ -22,19 +20,15 @@ in
}; };
config = lib.mkIf enable { config = lib.mkIf enable {
assertions = [
(ctp.assertXdgEnabled "Fcitx5")
];
xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavour}" = { xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavour}" = {
source = "${sources.fcitx5}/src/catppuccin-${cfg.flavour}"; source = "${sources.fcitx5}/src/catppuccin-${cfg.flavour}";
recursive = true; 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 { } { text = lib.generators.toINIWithGlobalSection { } {
globalSection.Theme = "catppuccin-${cfg.flavour}"; globalSection.Theme = "catppuccin-${cfg.flavour}";
}; };
}); };
}; };
} }

View file

@ -3,22 +3,17 @@
, ... , ...
}: }:
let let
inherit (lib) ctp mkIf;
inherit (config.catppuccin) sources; inherit (config.catppuccin) sources;
cfg = config.programs.fish.catppuccin; cfg = config.programs.fish.catppuccin;
enable = cfg.enable && config.programs.fish.enable; enable = cfg.enable && config.programs.fish.enable;
themeName = "Catppuccin ${ctp.mkUpper cfg.flavour}"; themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavour}";
themePath = "/themes/${themeName}.theme"; themePath = "/themes/${themeName}.theme";
in in
{ {
options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish"; options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish";
config = mkIf enable { config = lib.mkIf enable {
assertions = [
(lib.ctp.assertXdgEnabled "fish")
];
xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}";
programs.fish.shellInit = '' programs.fish.shellInit = ''

View file

@ -8,7 +8,7 @@ let
cfg = config.gtk.catppuccin; cfg = config.gtk.catppuccin;
enable = cfg.enable && config.gtk.enable; enable = cfg.enable && config.gtk.enable;
# "dark" and "light" can be used alongside the regular accents # "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 in
{ {
options.gtk.catppuccin = options.gtk.catppuccin =
@ -39,10 +39,6 @@ in
}; };
config = lib.mkIf enable { config = lib.mkIf enable {
assertions = [
(ctp.assertXdgEnabled "gtk")
];
gtk = { gtk = {
theme = theme =
let let
@ -87,7 +83,7 @@ in
name = "Papirus-${polarity}"; name = "Papirus-${polarity}";
package = pkgs.catppuccin-papirus-folders.override { package = pkgs.catppuccin-papirus-folders.override {
flavor = cfg.icon.flavour; flavor = cfg.icon.flavour;
accent = cfg.icon.accent; inherit (cfg.icon) accent;
}; };
}; };
}; };
@ -112,7 +108,7 @@ in
]; ];
}; };
"org/gnome/shell/extensions/user-theme" = { "org/gnome/shell/extensions/user-theme" = {
name = config.gtk.theme.name; inherit (config.gtk.theme) name;
}; };
"org/gnome/desktop/interface" = { "org/gnome/desktop/interface" = {
color-scheme = color-scheme =

View file

@ -23,10 +23,6 @@ in
config = config =
lib.mkIf enable lib.mkIf enable
{ {
assertions = [
(lib.ctp.assertXdgEnabled "k9s")
];
xdg.configFile."k9s${themePath}".source = theme; xdg.configFile."k9s${themePath}".source = theme;
programs.k9s.settings.k9s.ui.skin = themeName; programs.k9s.settings.k9s.ui.skin = themeName;

View file

@ -14,10 +14,6 @@ in
lib.ctp.mkCatppuccinOpt "micro"; lib.ctp.mkCatppuccinOpt "micro";
config = lib.mkIf enable { config = lib.mkIf enable {
assertions = [
(lib.ctp.assertXdgEnabled "micro")
];
programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath;
xdg.configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}"; xdg.configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}";

View file

@ -3,7 +3,6 @@
, ... , ...
}: }:
let let
inherit (lib) ctp;
inherit (config.catppuccin) sources; inherit (config.catppuccin) sources;
cfg = config.programs.yazi.catppuccin; cfg = config.programs.yazi.catppuccin;
@ -11,14 +10,10 @@ let
in in
{ {
options.programs.yazi.catppuccin = options.programs.yazi.catppuccin =
ctp.mkCatppuccinOpt "yazi"; lib.ctp.mkCatppuccinOpt "yazi";
config = lib.mkIf enable { config = lib.mkIf enable {
assertions = [
(lib.ctp.assertXdgEnabled "yazi")
];
programs.yazi.theme = lib.importTOML "${sources.yazi}/themes/${cfg.flavour}.toml"; 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";
}; };
} }

View file

@ -111,11 +111,6 @@ in
# followed by the local config attrset # followed by the local config attrset
mkAccentOpt = ctp.mkBasicOpt "accent" ctp.types.accentOption; 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 # a -> a -> a
# see https://nlewo.github.io/nixos-manual-sphinx/development/option-types.xml.html # 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`. # by default enums cannot be merged, but they keep their passed value in `functor.payload`.