dotfiles/home/apps/discord.nix

75 lines
2.3 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-09-08 02:18:28 +02:00
css = # css
''
@import url('//fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap');
:root {
--font-primary: "IBM Plex Sans", sans-serif;
--font-headline: "IBM Plex Sans", sans-serif;
--font-display: "IBM Plex Sans", sans-serif;
--font-code: "Berkeley Mono", "IBM Plex Mono", "Symbols Nerd Font", mono;
}
@media (max-width: 1024px) {
nav[aria-label="Servers sidebar"] {
display: none;
}
.platform-osx div[class^="base_"]>div[class^="content_"]>div[class^="sidebar_"],
.platform-osx div[class^="base_"]>div[class^="content_"]>main[class^="container_"],
.platform-osx div[class^="base_"]>div[class^="content_"]>div[class^="chat_"] {
padding-top: 32px !important;
}
}
@media (max-width: 768px) {
div[class^="base_"]>div[class^="content_"]>div[class^="sidebar_"] {
display: none;
}
}
'';
2024-05-07 18:20:52 +02:00
in
{
2023-11-28 12:21:17 +01:00
config = lib.mkIf config.isGraphical {
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 = {
2024-09-08 02:18:28 +02:00
inherit css;
2024-05-07 18:20:52 +02:00
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
}