11.stylix/modules/discord/hm.nix
Flameopathic 71f8b1166b
nixcord: change theme location on nix-darwin (#1221)
Link: https://github.com/danth/stylix/pull/1221

Closes: https://github.com/danth/stylix/issues/1220

Related: https://github.com/danth/stylix/pull/784

Reviewed-by: awwpotato <awwpotato@voidq.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Reviewed-by: eveeifyeve <88671402+Eveeifyeve@users.noreply.github.com>
2025-05-14 18:03:53 -07:00

94 lines
3.1 KiB
Nix

{
config,
lib,
pkgs,
options,
...
}:
let
template = import ./template.nix {
inherit (config.lib.stylix) colors;
inherit (config.stylix) fonts;
};
in
{
imports = lib.singleton (
lib.mkRemovedOptionModule [ "stylix" "targets" "vesktop" "extraCss" ]
"CSS can be added to by declaring 'programs.vesktop.vencord.themes.stylix = lib.mkAfter \"YOUR EXTRA CSS\";"
);
options.stylix.targets = {
vesktop.enable = config.lib.stylix.mkEnableTarget "Vesktop" true;
vencord = {
enable = config.lib.stylix.mkEnableTarget "Vencord" true;
extraCss = lib.mkOption {
description = "Extra CSS to added to Vencord's theme";
type = lib.types.lines;
default = "";
};
};
nixcord = {
enable = config.lib.stylix.mkEnableTarget "Nixcord" true;
extraCss = lib.mkOption {
description = "Extra CSS to added to Nixcord's theme";
type = lib.types.lines;
default = "";
};
};
};
config =
let
inherit (config.programs) nixcord;
in
lib.mkIf config.stylix.enable (
lib.mkMerge [
(lib.mkIf config.stylix.targets.vencord.enable {
xdg.configFile."Vencord/themes/stylix.theme.css".text =
template + config.stylix.targets.vencord.extraCss;
})
(lib.mkIf config.stylix.targets.vesktop.enable {
programs.vesktop.vencord = {
themes.stylix = template;
settings.enabledThemes = [ "stylix.css" ];
};
})
(lib.mkIf config.stylix.targets.nixcord.enable (
lib.optionalAttrs (builtins.hasAttr "nixcord" options.programs) (
lib.mkMerge [
(lib.mkIf nixcord.discord.enable (
lib.mkMerge [
(lib.mkIf (!pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable) {
xdg.configFile."Vencord/themes/stylix.theme.css".text =
template + config.stylix.targets.nixcord.extraCss;
})
(lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && !config.xdg.enable) {
home.file."Library/Application Support/Vencord/themes/stylix.theme.css".text =
template + config.stylix.targets.nixcord.extraCss;
})
]
))
(lib.mkIf nixcord.vesktop.enable (
lib.mkMerge [
(lib.mkIf (!pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable) {
xdg.configFile."vesktop/themes/stylix.theme.css".text =
template + config.stylix.targets.nixcord.extraCss;
})
(lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && !config.xdg.enable) {
home.file."Library/Application Support/vesktop/themes/stylix.theme.css".text =
template + config.stylix.targets.nixcord.extraCss;
})
]
))
{
programs.nixcord.config.enabledThemes = [ "stylix.theme.css" ];
}
]
)
))
]
);
}