feat(discord): add settings generation
This commit is contained in:
parent
626b412d83
commit
4e9693a903
2 changed files with 45 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./browsers.nix
|
||||
./discord.nix
|
||||
./fonts.nix
|
||||
./git.nix
|
||||
./gpg.nix
|
||||
|
|
44
home/apps/discord.nix
Normal file
44
home/apps/discord.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
home.activation.discordSettings = let
|
||||
themeUrl = flavor: "https://catppuccin.github.io/discord/dist/catppuccin-${flavor}-pink.theme.css";
|
||||
css = ''
|
||||
@import url("${themeUrl "mocha"}") (prefers-color-scheme: dark);
|
||||
@import url("${themeUrl "latte"}") (prefers-color-scheme: light);
|
||||
: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", "Symbols Nerd Font", mono;
|
||||
}
|
||||
'';
|
||||
json = pkgs.writeTextFile {
|
||||
name = "discord-settings.json";
|
||||
text =
|
||||
lib.generators.toJSON {}
|
||||
{
|
||||
SKIP_HOST_UPDATE = true;
|
||||
openasar = {
|
||||
inherit css;
|
||||
setup = true;
|
||||
};
|
||||
trayBalloonShown = false;
|
||||
};
|
||||
};
|
||||
path =
|
||||
if isLinux
|
||||
then config.xdg.configHome + "/discord/settings.json"
|
||||
else if isDarwin
|
||||
then config.home.home + "/Library/Application Support/discord/settings.json"
|
||||
else throw "unsupported platform";
|
||||
in
|
||||
lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
[ -d "$(dirname "${path}")" ] && cp -f "${json}" "${path}"
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue