11.stylix/modules/discord/nixcord.nix
NAHO bae3064215
modules: replace static builtins.hasAttrs instances with '?' operator (#1913)
Fixes: c32c82e460 ("zen-browser: init (#1694)")
Fixes: e594886eb0 ("nixcord: init (#767)")
Link: https://github.com/nix-community/stylix/pull/1913

Reviewed-by: awwpotato <awwpotato@voidq.com>
2025-09-28 16:25:46 +02:00

71 lines
2.1 KiB
Nix

mkTarget:
{
lib,
config,
pkgs,
options,
...
}:
mkTarget {
name = "nixcord";
humanName = "Nixcord";
extraOptions = {
themeBody = lib.mkOption {
type = lib.types.lines;
default = "";
internal = true;
};
extraCss = lib.mkOption {
description = "Extra CSS to added to Nixcord's theme";
type = lib.types.lines;
default = "";
};
};
configElements = (import ./common/theme-elements.nix "nixcord") ++ [
(
{ cfg }:
let
inherit (config.programs) nixcord;
in
lib.mkIf
(cfg.themeBody != (import ./common/theme-header.nix) || cfg.extraCss != "")
(
lib.optionalAttrs (options.programs ? nixcord) (
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 =
cfg.themeBody + cfg.extraCss;
})
(lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && !config.xdg.enable) {
home.file."Library/Application Support/Vencord/themes/stylix.theme.css".text =
cfg.themeBody + cfg.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 =
cfg.themeBody + cfg.extraCss;
})
(lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && !config.xdg.enable) {
home.file."Library/Application Support/vesktop/themes/stylix.theme.css".text =
cfg.themeBody + cfg.extraCss;
})
]
))
{
programs.nixcord.config.enabledThemes = [ "stylix.theme.css" ];
}
]
)
)
)
];
}