dotfiles/home/apps/discord.nix

60 lines
1.7 KiB
Nix
Raw Normal View History

2023-07-06 09:20:54 +02:00
{
config,
lib,
pkgs,
...
2024-05-07 18:20:52 +02:00
}:
let
2023-07-06 09:20:54 +02:00
inherit (pkgs.stdenv) isDarwin isLinux;
2024-05-07 18:20:52 +02:00
in
{
2023-11-28 12:21:17 +01:00
config = lib.mkIf config.isGraphical {
home.packages =
2024-05-07 18:20:52 +02:00
(lib.optionals isDarwin [ (pkgs.discord.override { withOpenASAR = true; }) ])
++ (lib.optionals isLinux [ (pkgs.vesktop.override { withSystemVencord = false; }) ]);
2024-05-02 21:17:23 +02:00
2024-05-07 18:20:52 +02:00
home.activation.discordSettings =
let
json = pkgs.writeTextFile {
name = "discord-settings.json";
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;
};
trayBalloonShown = false;
SKIP_HOST_UPDATE = true;
2023-07-06 09:20:54 +02:00
};
2024-02-18 13:50:05 +01:00
};
2024-05-07 18:20:52 +02:00
path =
if isLinux then
"${config.xdg.configHome}/discord/settings.json"
else if isDarwin then
"${config.home.homeDirectory}/Library/Application Support/discord/settings.json"
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
2024-05-07 18:20:52 +02:00
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
2023-11-28 12:21:17 +01:00
mkdir -p "$(dirname "${path}")"
cp -f "${json}" "${path}"
'';
2024-05-02 21:17:23 +02:00
services.arrpc.enable = isLinux;
launchd.agents.arrpc = {
enable = isDarwin;
config = {
2024-05-07 18:20:52 +02:00
ProgramArguments = [ "${pkgs.arrpc}/bin/arrpc" ];
KeepAlive = true;
RunAtLoad = true;
};
};
2024-05-02 21:17:23 +02:00
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
}