diff --git a/hosts/common/user/configs/gui/ags/default.nix b/hosts/common/user/configs/gui/ags/default.nix index 0749ec4..0fc751b 100644 --- a/hosts/common/user/configs/gui/ags/default.nix +++ b/hosts/common/user/configs/gui/ags/default.nix @@ -18,7 +18,7 @@ in programs.ags.enable = true; xdg.configFile."ags/config.js".source = "${agsConfig}/share/config.js"; - theme.templates."${home}/.config/ags/theme.sass".source = ./theme.sass; + theme.template."${home}/.config/ags/theme.sass".source = ./theme.sass; systemd.user = { targets.tray.Unit = { diff --git a/hosts/common/user/configs/gui/btop/default.nix b/hosts/common/user/configs/gui/btop/default.nix index 2473061..0248d34 100644 --- a/hosts/common/user/configs/gui/btop/default.nix +++ b/hosts/common/user/configs/gui/btop/default.nix @@ -13,7 +13,7 @@ programs.btop.settings.color_theme = "matugen"; theme = { - templates."${home}/.config/btop/themes/matugen.theme".source = ./theme.theme; + template."${home}/.config/btop/themes/matugen.theme".source = ./theme.theme; extraConfig = "${ lib.meta.getExe ( diff --git a/hosts/common/user/configs/gui/discord/default.nix b/hosts/common/user/configs/gui/discord/default.nix new file mode 100644 index 0000000..a432cd8 --- /dev/null +++ b/hosts/common/user/configs/gui/discord/default.nix @@ -0,0 +1,73 @@ +{ + user ? throw "user argument is required", + home ? throw "home argument is required", +}: +{ lib, pkgs, ... }: +{ + nixpkgs.overlays = [ + (final: prev: { + vesktop = prev.vesktop.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [ ] ++ [ ./readonly-fix.patch ]; + }); + }) + ]; + + environment.persistence = { + "/persist"."${home}/.config/vesktop" = { }; + "/cache" = { + "${home}/.config/vesktop/sessionData/Cache" = { }; + "${home}/.config/vesktop/sessionData/Code Cache" = { }; + "${home}/.config/vesktop/sessionData/DawnGraphiteCache" = { }; + "${home}/.config/vesktop/sessionData/DawnWebGPUCache" = { }; + "${home}/.config/vesktop/sessionData/GPUCache" = { }; + }; + }; + + home-manager.users.${user} = { + home.packages = with pkgs; [ vesktop ]; + + xdg.configFile."vesktop/state.json".source = (pkgs.formats.json { }).generate "state.json" { + firstLaunch = false; + }; + + xdg.configFile."vesktop/settings.json".source = (pkgs.formats.json { }).generate "settings.json" { + discordBranch = "stable"; + minimizeToTray = false; + arRPC = false; + }; + + xdg.configFile."vesktop/settings/settings.json".source = + (pkgs.formats.json { }).generate "settings.json" + { + autoUpdate = false; + tray = false; + plugins = { + MessageEventsAPI.enabled = true; + MessageUpdaterAPI.enabled = true; + UserSettingsAPI.enabled = true; + AlwaysTrust.enabled = true; + BetterGifAltText.enabled = true; + BetterRoleContext = { + enabled = true; + roleIconFileFormat = "png"; + }; + ClearURLs.enabled = true; + FakeNitro.enabled = true; + MessageClickActions.enabled = true; + MessageLogger = { + enabled = true; + deleteStyle = "overlay"; + }; + NoF1.enabled = true; + NoOnboardingDelay.enabled = true; + NoReplyMention = { + enabled = true; + userList = ""; + }; + }; + enabledThemes = [ "matugen.theme.css" ]; + }; + + theme.template."${home}/.config/vesktop/themes/matugen.theme.css".source = ./theme.css; + }; +} diff --git a/hosts/common/user/configs/gui/discord/readonly-fix.patch b/hosts/common/user/configs/gui/discord/readonly-fix.patch new file mode 100644 index 0000000..710a865 --- /dev/null +++ b/hosts/common/user/configs/gui/discord/readonly-fix.patch @@ -0,0 +1,17 @@ +diff --git a/src/main/settings.ts b/src/main/settings.ts +index 6fad97f..dfc64e3 100644 +--- a/src/main/settings.ts ++++ b/src/main/settings.ts +@@ -26,8 +26,10 @@ function loadSettings(file: string, name: string) { + + const store = new SettingsStore(settings); + store.addGlobalChangeListener(o => { +- mkdirSync(dirname(file), { recursive: true }); +- writeFileSync(file, JSON.stringify(o, null, 4)); ++ try { ++ mkdirSync(dirname(file), { recursive: true }); ++ writeFileSync(file, JSON.stringify(o, null, 4)); ++ } catch {} + }); + + return store; diff --git a/hosts/common/user/configs/gui/discord/theme.css b/hosts/common/user/configs/gui/discord/theme.css new file mode 100644 index 0000000..dfb0d79 --- /dev/null +++ b/hosts/common/user/configs/gui/discord/theme.css @@ -0,0 +1,76 @@ +/* +@name Matugen +@author Matugen +@version 0.0.1 +@description Theme configured via NixOS or Home Manager. +*/ + +.theme-dark { + --bg-overlay-2: {{colors.surface_container_high.dark.hex}}; + --home-background: {{colors.surface_container_high.dark.hex}}; + --background-primary: {{colors.surface_container_high.dark.hex}}; + + --background-secondary: {{colors.surface_container.dark.hex}}; + --background-secondary-alt: {{colors.surface_container.dark.hex}}; + --background-accent: {{colors.surface_container.dark.hex}}; + --background-modifier-hover: {{colors.surface_container.dark.hex}}; + + --background-tertiary: {{colors.surface_container_low.dark.hex}}; + --background-floating: {{colors.surface_container_low.dark.hex}}; + + --background-modifier-selected: {{colors.primary_container.dark.hex}}; + --background-modifier-accent: {{colors.outline_variant.dark.hex}}; + + --channeltextarea-background: {{colors.surface_container.dark.hex}}; + + --text-normal: {{colors.on_surface.dark.hex}}; + --text-secondary: {{colors.on_surface_variant.dark.hex}}; + --text-muted: {{colors.outline.dark.hex}}; + --text-link: {{colors.primary.dark.hex}}; + + --interactive-normal: {{colors.on_surface.dark.hex}}; + --interactive-hover: {{colors.on_surface.dark.hex}}; + --interactive-active: {{colors.on_primary_container.dark.hex}}; + --interactive-muted: {{colors.outline_variant.dark.hex}}; + + --channels-default: {{colors.outline.dark.hex}}; + --channel-icon: {{colors.outline.dark.hex}}; + + --header-primary: {{colors.on_surface.dark.hex}}; + --header-secondary: {{colors.on_surface_variant.dark.hex}}; +} + +.theme-light { + --bg-overlay-2: {{colors.surface_container_high.light.hex}}; + --home-background: {{colors.surface_container_high.light.hex}}; + --background-primary: {{colors.surface_container_high.light.hex}}; + + --background-secondary: {{colors.surface_container.light.hex}}; + --background-secondary-alt: {{colors.surface_container.light.hex}}; + --background-accent: {{colors.surface_container.light.hex}}; + --background-modifier-hover: {{colors.surface_container.light.hex}}; + + --background-tertiary: {{colors.surface_container_low.light.hex}}; + --background-floating: {{colors.surface_container_low.light.hex}}; + + --background-modifier-selected: {{colors.primary_container.light.hex}}; + --background-modifier-accent: {{colors.outline_variant.light.hex}}; + + --channeltextarea-background: {{colors.surface_container.light.hex}}; + + --text-normal: {{colors.on_surface.light.hex}}; + --text-secondary: {{colors.on_surface_variant.light.hex}}; + --text-muted: {{colors.outline.light.hex}}; + --text-link: {{colors.primary.light.hex}}; + + --interactive-normal: {{colors.on_surface.light.hex}}; + --interactive-hover: {{colors.on_surface.light.hex}}; + --interactive-active: {{colors.on_primary_container.light.hex}}; + --interactive-muted: {{colors.outline_variant.light.hex}}; + + --channels-default: {{colors.outline.light.hex}}; + --channel-icon: {{colors.outline.light.hex}}; + + --header-primary: {{colors.on_surface.light.hex}}; + --header-secondary: {{colors.on_surface_variant.light.hex}}; +} diff --git a/hosts/common/user/configs/gui/gtk/default.nix b/hosts/common/user/configs/gui/gtk/default.nix index 018a6c5..c331dd4 100644 --- a/hosts/common/user/configs/gui/gtk/default.nix +++ b/hosts/common/user/configs/gui/gtk/default.nix @@ -52,7 +52,7 @@ in ); }; - theme.templates = { + theme.template = { "${home}/.config/gtk-3.0/theme.css".source = ./theme.css; "${home}/.config/gtk-4.0/theme.css".source = ./theme.css; }; diff --git a/hosts/common/user/configs/gui/hyprland/default.nix b/hosts/common/user/configs/gui/hyprland/default.nix index b2d0f21..69309c0 100644 --- a/hosts/common/user/configs/gui/hyprland/default.nix +++ b/hosts/common/user/configs/gui/hyprland/default.nix @@ -138,7 +138,7 @@ ''; theme = { - templates."${home}/.config/hypr/theme.conf".source = ./theme.conf; + template."${home}/.config/hypr/theme.conf".source = ./theme.conf; extraConfig = "${ lib.meta.getExe ( diff --git a/hosts/common/user/configs/gui/kitty/default.nix b/hosts/common/user/configs/gui/kitty/default.nix index ad84fab..77f9b0a 100644 --- a/hosts/common/user/configs/gui/kitty/default.nix +++ b/hosts/common/user/configs/gui/kitty/default.nix @@ -31,7 +31,7 @@ in }; theme = { - templates."${home}/.config/kitty/theme.conf".source = ./theme.conf; + template."${home}/.config/kitty/theme.conf".source = ./theme.conf; extraConfig = "${ lib.meta.getExe ( diff --git a/hosts/common/user/configs/gui/obsidian/default.nix b/hosts/common/user/configs/gui/obsidian/default.nix index 534d703..3f983db 100644 --- a/hosts/common/user/configs/gui/obsidian/default.nix +++ b/hosts/common/user/configs/gui/obsidian/default.nix @@ -704,7 +704,7 @@ in }; }; - theme.templates = lib.attrsets.mapAttrs' ( + theme.template = lib.attrsets.mapAttrs' ( _: vault: lib.attrsets.nameValuePair "${vault.target}/.obsidian/plugins/obsidian-style-settings/data.json" { source = ./theme.json; diff --git a/hosts/common/user/configs/gui/qt/default.nix b/hosts/common/user/configs/gui/qt/default.nix index c14668b..9e0f178 100644 --- a/hosts/common/user/configs/gui/qt/default.nix +++ b/hosts/common/user/configs/gui/qt/default.nix @@ -24,7 +24,7 @@ QT_QPA_PLATFORMTHEME = "qt5ct"; }; - theme.templates = { + theme.template = { # https://github.com/GabePoel/KvLibadwaita/blob/main/src/KvLibadwaita/KvLibadwaita.kvconfig "${home}/.config/Kvantum/KvAdwQt/KvAdwQt.kvconfig".source = ./KvAdwQt/KvAdwQt.kvconfig; # https://github.com/GabePoel/KvLibadwaita/blob/main/src/KvLibadwaita/KvLibadwaita.svg diff --git a/hosts/common/user/configs/gui/spicetify/default.nix b/hosts/common/user/configs/gui/spicetify/default.nix index 2a0936a..dd27056 100644 --- a/hosts/common/user/configs/gui/spicetify/default.nix +++ b/hosts/common/user/configs/gui/spicetify/default.nix @@ -140,6 +140,6 @@ }; }; - theme.templates."${home}/.config/spotify/colors.css".source = ./colors.css; + theme.template."${home}/.config/spotify/colors.css".source = ./colors.css; }; } diff --git a/hosts/common/user/configs/gui/theme/options.nix b/hosts/common/user/configs/gui/theme/options.nix index 217f182..3a3bbde 100644 --- a/hosts/common/user/configs/gui/theme/options.nix +++ b/hosts/common/user/configs/gui/theme/options.nix @@ -71,7 +71,7 @@ in description = "Extra configuration lines to add to the theme reload script."; }; - templates = mkOption { + template = mkOption { type = attrsOf ( submodule ( { name, config, ... }: @@ -514,7 +514,7 @@ in templates = builtins.mapAttrs (name: template: { input_path = template.source or (pkgs.writeText name template.text); output_path = template.target; - }) cfg.templates; + }) cfg.template; } ); }; diff --git a/hosts/eirene/users/nick.nix b/hosts/eirene/users/nick.nix index 3c2a47e..8770254 100644 --- a/hosts/eirene/users/nick.nix +++ b/hosts/eirene/users/nick.nix @@ -38,6 +38,7 @@ in (import ../../common/user/configs/gui/btop { inherit user home; }) (import ../../common/user/configs/gui/chromium { inherit user home; }) (import ../../common/user/configs/gui/cliphist { inherit user home; }) + (import ../../common/user/configs/gui/discord { inherit user home; }) (import ../../common/user/configs/gui/emoji { inherit user home; }) (import ../../common/user/configs/gui/firefox { inherit user home; }) (import ../../common/user/configs/gui/gaming { inherit user home; })