dotfiles/home/apps/discord.nix

52 lines
1.4 KiB
Nix
Raw Normal View History

2023-07-06 09:20:54 +02:00
{
config,
lib,
pkgs,
...
}: let
inherit (pkgs.stdenv) isDarwin isLinux;
in {
2023-11-28 12:21:17 +01:00
config = lib.mkIf config.isGraphical {
home.packages =
2024-04-27 02:07:37 +02:00
(lib.optionals isDarwin [
(pkgs.discord.override {withOpenASAR = true;})
])
++ (lib.optionals isLinux [
2024-04-23 06:34:22 +02:00
(pkgs.vesktop.override {withSystemVencord = false;})
]);
2024-05-02 21:17:23 +02:00
2023-11-28 12:21:17 +01:00
home.activation.discordSettings = let
json = pkgs.writeTextFile {
name = "discord-settings.json";
2024-02-18 13:50:05 +01:00
text = lib.generators.toJSON {} {
DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true;
MIN_WIDTH = 0;
MIN_HEIGHT = 0;
openasar = {
css = builtins.readFile ./discord/custom.css;
setup = true;
2023-07-06 09:20:54 +02:00
};
2024-02-18 13:50:05 +01:00
trayBalloonShown = false;
SKIP_HOST_UPDATE = true;
};
2023-11-28 12:21:17 +01:00
};
path =
if isLinux
2024-02-18 13:50:05 +01:00
then "${config.xdg.configHome}/discord/settings.json"
2023-11-28 12:21:17 +01:00
else if isDarwin
2024-02-18 13:50:05 +01:00
then "${config.home.homeDirectory}/Library/Application Support/discord/settings.json"
2023-11-28 12:21:17 +01:00
else throw "unsupported platform";
in
2024-02-18 13:50:05 +01:00
# gets written as a file after the writeBoundary to keep it mutable
2023-11-28 12:21:17 +01:00
lib.hm.dag.entryAfter ["writeBoundary"] ''
mkdir -p "$(dirname "${path}")"
cp -f "${json}" "${path}"
'';
2024-05-02 21:17:23 +02:00
services.arrpc.enable = isLinux;
services.discord-applemusic-rich-presence.enable = isDarwin;
services.mpd-discord-rpc.enable = isLinux;
2023-11-28 12:21:17 +01:00
};
2023-07-06 09:20:54 +02:00
}