discord: combine nixcord, vencord, and vesktop modules (#854)
Link: https://github.com/danth/stylix/pull/854 Reviewed-by: Daniel Thwaites <danth@danth.me> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
21d68dab9d
commit
7feb1c29bf
7 changed files with 102 additions and 93 deletions
67
modules/discord/hm.nix
Normal file
67
modules/discord/hm.nix
Normal file
|
|
@ -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" ];
|
||||
}
|
||||
))
|
||||
]
|
||||
);
|
||||
}
|
||||
21
modules/discord/testbeds/vencord.nix
Normal file
21
modules/discord/testbeds/vencord.nix
Normal file
|
|
@ -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"
|
||||
];
|
||||
}
|
||||
14
modules/discord/testbeds/vesktop.nix
Normal file
14
modules/discord/testbeds/vesktop.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
package = pkgs.vesktop;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
name = "vesktop";
|
||||
inherit package;
|
||||
};
|
||||
|
||||
environment.systemPackages = [ package ];
|
||||
}
|
||||
|
|
@ -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" ];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
@ -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;
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue