diff --git a/modules/discord/hm.nix b/modules/discord/hm.nix new file mode 100644 index 00000000..b9133ab1 --- /dev/null +++ b/modules/discord/hm.nix @@ -0,0 +1,67 @@ +{ + config, + lib, + pkgs, + options, + ... +}: +let + template = + let + inherit (config.lib.stylix) colors; + inherit (config.stylix) fonts; + in + import ./template.nix { inherit colors fonts; }; +in +{ + options.stylix.targets = + let + inherit (config.lib.stylix) mkEnableTarget; + in + { + vencord.enable = mkEnableTarget "Vencord" true; + vesktop.enable = mkEnableTarget "Vesktop" true; + nixcord.enable = mkEnableTarget "Nixcord" true; + }; + + config = lib.mkIf config.stylix.enable ( + lib.mkMerge [ + (lib.mkIf config.stylix.targets.vencord.enable { + xdg.configFile."Vencord/themes/stylix.theme.css".text = template; + }) + + (lib.mkIf config.stylix.targets.vesktop.enable ( + lib.mkMerge [ + (lib.mkIf pkgs.stdenv.hostPlatform.isLinux { + xdg.configFile."vesktop/themes/stylix.theme.css".text = template; + }) + + (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { + home.file."Library/Application Support/vesktop/themes/stylix.theme.css".text = + template; + }) + ] + )) + + (lib.mkIf config.stylix.targets.nixcord.enable ( + lib.optionalAttrs (builtins.hasAttr "nixcord" options.programs) { + xdg.configFile = + let + inherit (config.programs) nixcord; + in + lib.mkMerge [ + (lib.mkIf nixcord.discord.enable { + "Vencord/themes/stylix.theme.css".text = template; + }) + + (lib.mkIf nixcord.vesktop.enable { + "vesktop/themes/stylix.theme.css".text = template; + }) + ]; + + programs.nixcord.config.enabledThemes = [ "stylix.theme.css" ]; + } + )) + ] + ); +} diff --git a/modules/vencord/template.nix b/modules/discord/template.nix similarity index 100% rename from modules/vencord/template.nix rename to modules/discord/template.nix diff --git a/modules/discord/testbeds/vencord.nix b/modules/discord/testbeds/vencord.nix new file mode 100644 index 00000000..1fcaef05 --- /dev/null +++ b/modules/discord/testbeds/vencord.nix @@ -0,0 +1,21 @@ +{ lib, pkgs, ... }: + +let + package = pkgs.discord.override { + withVencord = true; + }; +in +{ + stylix.testbed.application = { + enable = true; + name = "discord"; + inherit package; + }; + + environment.systemPackages = [ package ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "discord" + ]; +} diff --git a/modules/discord/testbeds/vesktop.nix b/modules/discord/testbeds/vesktop.nix new file mode 100644 index 00000000..d4588fa8 --- /dev/null +++ b/modules/discord/testbeds/vesktop.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +let + package = pkgs.vesktop; +in +{ + stylix.testbed.application = { + enable = true; + name = "vesktop"; + inherit package; + }; + + environment.systemPackages = [ package ]; +} diff --git a/modules/nixcord/hm.nix b/modules/nixcord/hm.nix deleted file mode 100644 index c3a3e6d2..00000000 --- a/modules/nixcord/hm.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - config, - lib, - options, - ... -}: -let - template = - let - inherit (config.lib.stylix) colors; - inherit (config.stylix) fonts; - in - import ../vencord/template.nix { inherit colors fonts; }; - cfg = config.stylix.targets.nixcord; -in -{ - options.stylix.targets.nixcord.enable = - config.lib.stylix.mkEnableTarget "Nixcord" true; - - config = - lib.mkIf (config.stylix.enable && cfg.enable && (config.programs ? nixcord)) - ( - lib.optionalAttrs (builtins.hasAttr "nixcord" options.programs) { - xdg.configFile = - let - inherit (config.programs) nixcord; - in - lib.mkMerge [ - (lib.mkIf nixcord.discord.enable { - "Vencord/themes/stylix.theme.css".text = template; - }) - - (lib.mkIf nixcord.vesktop.enable { - "vesktop/themes/stylix.theme.css".text = template; - }) - ]; - - programs.nixcord.config.enabledThemes = [ "stylix.theme.css" ]; - } - ); -} diff --git a/modules/vencord/hm.nix b/modules/vencord/hm.nix deleted file mode 100644 index ceb66120..00000000 --- a/modules/vencord/hm.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib, ... }: -let - template = - let - inherit (config.lib.stylix) colors; - inherit (config.stylix) fonts; - in - import ./template.nix { inherit colors fonts; }; -in -{ - options.stylix.targets.vencord.enable = - config.lib.stylix.mkEnableTarget "Vencord" true; - - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.vencord.enable) - { - xdg.configFile."Vencord/themes/stylix.theme.css".text = template; - }; -} diff --git a/modules/vesktop/hm.nix b/modules/vesktop/hm.nix deleted file mode 100644 index 90b7e180..00000000 --- a/modules/vesktop/hm.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -let - template = - let - inherit (config.lib.stylix) colors; - inherit (config.stylix) fonts; - in - import ../vencord/template.nix { inherit colors fonts; }; -in -{ - options.stylix.targets.vesktop.enable = - config.lib.stylix.mkEnableTarget "Vesktop" true; - - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.vesktop.enable) - ( - lib.mkMerge [ - (lib.mkIf pkgs.stdenv.hostPlatform.isLinux { - xdg.configFile."vesktop/themes/stylix.theme.css".text = template; - }) - - (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { - home.file."Library/Application Support/vesktop/themes/stylix.theme.css".text = - template; - }) - ] - ); -}