nixos-config/home-manager/modules/discord/default.nix
Glen Goodwin 2220c4e917 refactor: major structural changes
git updates

update tmux conf

add ansible tools

squash me

squash

fix: get git aliases from plugin

virt stuff

add devenv

some virt updates

kubernetes
2023-12-05 18:11:12 -05:00

45 lines
1.2 KiB
Nix

{
config,
pkgs,
lib,
...
}: let
cfg = config.programs.discord;
discordPatcherBin = pkgs.writers.writePython3Bin "discord-krisp-patcher" {
libraries = with pkgs.python3Packages; [pyelftools capstone];
flakeIgnore = [
"E265" # from nix-shell shebang
"E501" # line too long (82 > 79 characters)
"F403" # 'from module import *' used; unable to detect undefined names
"F405" # name may be undefined, or defined from star imports: module
];
} (builtins.readFile ./krisp-patcher.py);
wrapDiscordBinary = pkgs.writeShellScriptBin "discord" ''
${pkgs.findutils}/bin/find -L $HOME/.config/discord -name 'discord_krisp.node' -exec ${discordPatcherBin}/bin/discord-krisp-patcher {} +
${pkgs.discord}/bin/discord "$@"
'';
discord = pkgs.discord.override {
# Performance mod
withOpenASAR = true;
# link fix
nss = pkgs.nss_latest;
};
in {
options.programs.discord = {
enable = lib.mkEnableOption "Discord";
wrapDiscord = lib.mkEnableOption "wrap the Discord binary with a patching each time";
};
config = lib.mkIf cfg.enable {
home.packages =
[discordPatcherBin]
++ (
if cfg.wrapDiscord
then [wrapDiscordBinary]
else [pkgs.discord]
);
};
}