discocss: add module

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
This commit is contained in:
Ilan Joselevich 2022-10-04 00:53:12 +03:00 committed by Robert Helgesson
parent 5597b3a742
commit 2d8e5a9934
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 59 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -93,6 +93,8 @@ Makefile @thiagokokada
/modules/programs/direnv.nix @rycee
/modules/programs/discocss.nix @Kranzes
/modules/programs/eclipse.nix @rycee
/modules/programs/emacs.nix @rycee

View file

@ -741,6 +741,13 @@ in
A new module is available: 'programs.havoc'.
'';
}
{
time = "2022-10-12T23:10:48+00:00";
message = ''
A new module is available: 'programs.discocss'.
'';
}
];
};
}

View file

@ -65,6 +65,7 @@ let
./programs/command-not-found/command-not-found.nix
./programs/dircolors.nix
./programs/direnv.nix
./programs/discocss.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/eww.nix

View file

@ -0,0 +1,49 @@
{ 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.discord.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;
};
}