Declarative Vencord configuration on NixOS | |
2024-11-01 | |
Last edit: 2024-11-01 | |
--------------------- | |
After installing | |
Vesktop | |
in the classic way on NixOS, i.e. by installing the `vesktop` package in the o… | |
So I found | |
Nixcord](https://github.com/KaylorBen/nixcord). It is a [home-manager](https://… | |
parameters and plugins in Nix. | |
It's pretty simple to use and works perfectly. Just add it to the home-manager'… | |
I've written my own Nix module that wraps nixcord, so here's what it looks like. | |
```nix | |
{ | |
config, | |
lib, | |
namespace, | |
... | |
}: | |
let | |
inherit (lib) mkIf types strings; | |
inherit (lib.${namespace}) | |
mkBoolOpt | |
mkOpt | |
enabled | |
disabled | |
; | |
cfg = config.${namespace}.messages.discord; | |
trimWith' = | |
s: | |
strings.trimWith { | |
start = true; | |
end = true; | |
} s; | |
in | |
{ | |
options.${namespace}.messages.discord = with types; { | |
enable = mkBoolOpt false "Whether or not to manage discord."; | |
quickCss = mkOpt str (builtins.readFile ./custom.css) "Vencord quick CSS."; | |
config = mkOpt attrs { | |
useQuickCss = ((trimWith' cfg.quickCss) != ""); | |
plugins = { | |
betterFolders = enabled; | |
betterRoleContext = enabled; | |
crashHandler = enabled; | |
memberCount = enabled; | |
mentionAvatars = enabled; | |
messageLatency = enabled; | |
showHiddenThings = enabled; | |
showMeYourName = enabled; | |
webContextMenus = enabled; | |
webKeybinds = enabled; | |
webScreenShareFixes = enabled; | |
alwaysAnimate = enabled; | |
}; | |
} "Manage the nixcord configuration."; | |
}; | |
config = mkIf cfg.enable { | |
stylix.targets.vesktop.enable = false; | |
programs.nixcord = { | |
enable = true; | |
discord = disabled; | |
vesktop.enable = true; | |
inherit (cfg) config quickCss; | |
}; | |
}; | |
} | |
``` | |
With regard to the above code snippet, please note that in my case, the home-ma… | |
Snowfall lib | |
. | |
```nix | |
enabled = { enable = true; }; | |
disabled = { enable = false; }; | |
``` | |
I've explicitly deactivated de Discord which is enabled by default, as well as … | |
Stylix](https://stylix.danth.me) because the [Dracula | |
theme (far too cyan-based). | |
Instead I downloaded | |
draculatheme.com/betterdiscord | |
so as not to depend on the Internet and activated it with the `quickCss` optio… | |
Nixcord | |
is really great, you really should use it ! | |