2022-10-03 21:53:12 +00:00
|
|
|
{ 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";
|
|
|
|
|
2023-07-01 09:41:32 +00:00
|
|
|
package = mkPackageOptionMD pkgs "discocss" { };
|
2022-10-03 21:53:12 +00:00
|
|
|
|
2023-07-01 09:41:32 +00:00
|
|
|
discordPackage = mkPackageOptionMD pkgs "discord" { };
|
2022-10-03 21:53:12 +00:00
|
|
|
|
|
|
|
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
|
2022-10-13 09:52:24 +00:00
|
|
|
-> !(any (p: p.name == cfg.discordPackage.name) config.home.packages);
|
2022-10-03 21:53:12 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|