From b19fb3d674bdbc4b61ba24a83ec0d5372416178d Mon Sep 17 00:00:00 2001 From: isabel Date: Sun, 2 Aug 2026 20:59:08 +0100 Subject: [PATCH] isabel/discord: simplify --- home/isabel/discord.nix | 194 ++++++++++++++++++------------ modules/home/programs/default.nix | 1 - modules/home/programs/discord.nix | 79 ------------ 3 files changed, 118 insertions(+), 156 deletions(-) delete mode 100644 modules/home/programs/discord.nix diff --git a/home/isabel/discord.nix b/home/isabel/discord.nix index 82463110..5509e745 100644 --- a/home/isabel/discord.nix +++ b/home/isabel/discord.nix @@ -1,86 +1,128 @@ -# this is a custom module provided by this flake. it is not in home-manager -{ pkgs, ... }: { - programs.discord = { - settings = { - SKIP_HOST_UPDATE = true; - DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true; - MIN_WIDTH = 940; - MIN_HEIGHT = 500; - openasar = { - setup = true; - quickstart = true; - }; - chromiumSwitches = { }; - IS_MAXIMIZED = true; - IS_MINIMIZED = false; - trayBalloonShown = true; + lib, + pkgs, + config, + ... +}: +let + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkOption; + inherit (pkgs.stdenv.hostPlatform) isLinux isDarwin; + + cfg = config.programs.discord; + + settingsFormat = pkgs.formats.json { }; +in +{ + options.programs.discord = { + moonlight = mkOption { + inherit (settingsFormat) type; + default = { }; + description = "Settings for Moonlight"; }; + }; - moonlight = { - enable = true; - settings = { - extensions = { - # keep-sorted start block=yes - betterCodeblocks = true; - betterEmbedsYT = true; - clearUrls = true; - cloneExpressions = true; - copyWebp = true; - disableSentry = true; - domOptimizer = true; - experiments = true; - favouriteGifSearch = true; - freeMoji = false; - freeScreenShare = true; - greentext = false; - httpCats = true; - imageViewer = true; - inviteToNowhere = true; - lastFmRpc = false; - memberCount = true; - moonbase = true; - nativeFixes = { - enabled = pkgs.stdenv.hostPlatform.isLinux; - config = { - vaapiIgnoreDriverChecks = true; - vaapiNvidia = true; - linuxAutoscroll = true; - zeroCopy = true; - ignoreGpuBlocklist = true; - waylandExplicitSync = true; - }; + config = mkMerge [ + (mkIf isDarwin { + programs.discord.package = null; + + home.file = { + "Library/Application Support/moonlight-mod/stable.json".source = + settingsFormat.generate "moonlight-settings.json" cfg.moonlight; + }; + }) + + (mkIf isLinux { + programs.discord.package = pkgs.discord.override { + withMoonlight = true; + }; + + xdg.configFile = { + "moonlight-mod/stable.json".source = + settingsFormat.generate "moonlight-settings.json" cfg.moonlight; + }; + }) + + { + programs.discord = { + settings = { + SKIP_HOST_UPDATE = true; + DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true; + MIN_WIDTH = 940; + MIN_HEIGHT = 500; + openasar = { + setup = true; + quickstart = true; }; - noHideToken = true; - noReplyChainNag = true; - noTrack = true; - onePingPerDM = true; - openExternally = true; - ownerCrown = true; - pronouns = true; - svgEmbed = true; - textReplacer = { - enabled = true; - config = { - patterns = { - "://tiktok.com/" = "://tnktok.com/"; - "://vm.tiktok.com/" = "://vm.tnktok.com/"; - "://www.tiktok.com/" = "://www.tnktok.com/"; - "://twitter.com/" = "://vxtwitter.com/"; - "://instagram.com/" = "://vxinstagram.com/"; - "://www.instagram.com/" = "://vxinstagram.com/"; - "://reddit.com/" = "://vxreddit.com/"; - "://www.reddit.com/" = "://vxreddit.com/"; - "://x.com/" = "://vxtwitter.com/"; + chromiumSwitches = { }; + IS_MAXIMIZED = true; + IS_MINIMIZED = false; + trayBalloonShown = true; + }; + + moonlight = { + extensions = { + # keep-sorted start block=yes + betterCodeblocks = true; + betterEmbedsYT = true; + clearUrls = true; + cloneExpressions = true; + copyWebp = true; + disableSentry = true; + domOptimizer = true; + experiments = true; + favouriteGifSearch = true; + freeMoji = false; + freeScreenShare = true; + greentext = false; + httpCats = true; + imageViewer = true; + inviteToNowhere = true; + lastFmRpc = false; + memberCount = true; + moonbase = true; + nativeFixes = { + enabled = pkgs.stdenv.hostPlatform.isLinux; + config = { + vaapiIgnoreDriverChecks = true; + vaapiNvidia = true; + linuxAutoscroll = true; + zeroCopy = true; + ignoreGpuBlocklist = true; + waylandExplicitSync = true; + }; + }; + noHideToken = true; + noReplyChainNag = true; + noTrack = true; + onePingPerDM = true; + openExternally = true; + ownerCrown = true; + pronouns = true; + svgEmbed = true; + textReplacer = { + enabled = true; + config = { + patterns = { + "://tiktok.com/" = "://tnktok.com/"; + "://vm.tiktok.com/" = "://vm.tnktok.com/"; + "://www.tiktok.com/" = "://www.tnktok.com/"; + "://twitter.com/" = "://vxtwitter.com/"; + "://instagram.com/" = "://vxinstagram.com/"; + "://www.instagram.com/" = "://vxinstagram.com/"; + "://reddit.com/" = "://vxreddit.com/"; + "://www.reddit.com/" = "://vxreddit.com/"; + "://x.com/" = "://vxtwitter.com/"; + }; }; }; + volumeManipulator = true; + # keep-sorted end }; - volumeManipulator = true; - # keep-sorted end - }; - repositories = [ "https://moonlight-mod.github.io/extensions-dist/repo.json" ]; + repositories = [ "https://moonlight-mod.github.io/extensions-dist/repo.json" ]; + }; }; - }; - }; + } + ]; } diff --git a/modules/home/programs/default.nix b/modules/home/programs/default.nix index 6004afd0..cb2b3d6b 100644 --- a/modules/home/programs/default.nix +++ b/modules/home/programs/default.nix @@ -2,7 +2,6 @@ imports = [ # keep-sorted start ./defaults.nix - ./discord.nix ./pentesting.nix # keep-sorted end ]; diff --git a/modules/home/programs/discord.nix b/modules/home/programs/discord.nix deleted file mode 100644 index 4e4c4e88..00000000 --- a/modules/home/programs/discord.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -let - inherit (lib.modules) mkIf mkMerge; - inherit (lib.options) mkEnableOption mkOption; - inherit (pkgs.stdenv.hostPlatform) isLinux isDarwin; - - cfg = config.programs.discord; - - settingsFormat = pkgs.formats.json { }; -in -{ - options.programs.discord = { - moonlight = { - enable = mkEnableOption "Moonlight support for Discord"; - - settings = mkOption { - inherit (settingsFormat) type; - default = { }; - description = "Settings for Moonlight"; - }; - }; - - vencord = { - enable = mkEnableOption "Vencord support for Discord"; - - settings = mkOption { - inherit (settingsFormat) type; - default = { }; - description = "Path to Vencord settings file"; - }; - }; - }; - - config = mkIf cfg.enable (mkMerge [ - (mkIf isDarwin { - programs.discord.package = null; - }) - - (mkIf isLinux { - programs.discord.package = pkgs.discord.override { - withMoonlight = cfg.moonlight.enable; - withVencord = cfg.vencord.enable; - }; - }) - - (mkIf (isLinux && cfg.moonlight.enable) { - xdg.configFile = { - "moonlight-mod/stable.json".source = - settingsFormat.generate "moonlight-settings.json" cfg.moonlight.settings; - }; - }) - - (mkIf (isDarwin && cfg.moonlight.enable) { - home.file = { - "Library/Application Support/moonlight-mod/stable.json".source = - settingsFormat.generate "moonlight-settings.json" cfg.moonlight.settings; - }; - }) - - (mkIf (isLinux && cfg.vencord.enable) { - xdg.configFile = { - "Vencord/settings/settings.json".source = - settingsFormat.generate "vencord-settings.json" cfg.vencord.settings; - }; - }) - - (mkIf (isDarwin && cfg.vencord.enable) { - home.file = { - "Library/Application Support/Vencord/settings/settings.json".source = - settingsFormat "vencord-settings.json" cfg.vencord.settings; - }; - }) - ]); -} -- knotmirror 0.0.1