diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3f50db65..33a52f5c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 830864d9..044ce393 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -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'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index f3e74009..b1bc0204 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -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 diff --git a/modules/programs/discocss.nix b/modules/programs/discocss.nix new file mode 100644 index 00000000..e782b560 --- /dev/null +++ b/modules/programs/discocss.nix @@ -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; + }; +}