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 {
|
2024-02-18 13:50:05 +01:00
|
|
|
home.packages = [(pkgs.discord.override {withOpenASAR = true;})];
|
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}"
|
|
|
|
'';
|
|
|
|
};
|
2023-07-06 09:20:54 +02:00
|
|
|
}
|