depot/third_party/home-manager/modules/programs/discocss.nix
Default email 2eafb8192e Project import generated by Copybara.
GitOrigin-RevId: 176e455371a8371586e8a3ff0d56ee9f3ca2324e
2023-01-10 02:35:00 -07:00

49 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let cfg = config.programs.discocss;
in {
meta.maintainers = with maintainers; [ kranzes ];
options = {
programs.discocss = {
enable = mkEnableOption
"discocss, a tiny Discord CSS injector for Linux and MacOS";
package = mkPackageOption pkgs "discocss" { };
discordPackage = mkPackageOption pkgs "discord" { };
discordAlias = mkOption {
type = types.bool;
default = true;
description = "Whether to alias discocss to discord.";
};
css = mkOption {
type = types.str;
default = "";
description = "The custom CSS for discocss to use.";
};
};
};
config = mkIf cfg.enable {
assertions = [{
assertion = cfg.discordAlias
-> !(any (p: p.name == cfg.discordPackage.name) config.home.packages);
message =
"To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false.";
}];
home.packages = [
(cfg.package.override {
discordAlias = cfg.discordAlias;
discord = cfg.discordPackage;
})
];
xdg.configFile."discocss/custom.css".text = cfg.css;
};
}