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