nixos/modules/features/vesktop.nix
2026-05-22 22:04:09 -04:00

130 lines
5 KiB
Nix

{
flake.nixosModules.vesktop = { pkgs, ... }: {
environment.systemPackages = let
discordTheme = pkgs.writeText "nix-managed-theme.css" ''
/**
* @name DiscordPlus Tokyo Night Muted Purple
* @author User
* @version 3.4.2
* @description Tokyo Night theme variants with desaturated, low-profile accents
*/
@import url("https://plusinsta.github.io/discord-plus/src/DiscordPlus-source.theme.css");
.theme-dark {
--dplus-backdrop: none !important;
/* Luminous Tokyo Night violet-slate containers */
--dplus-background-color-hue: 252;
--dplus-background-color-saturation-amount: 0.28;
--dplus-background-color-lightness-amount: 0.19;
--dplus-background-color-alpha: 0.75 !important;
/* Dialed saturation down to 35% and lightness to 48% */
/* This pulls the loud pop out of the purple, matching the deep storm aesthetic */
--dplus-accent-color-hue: 275;
--dplus-accent-color-saturation: 35%;
--dplus-accent-color-lightness: 48%;
--dplus-foreground-color-hue-base: 250;
--dplus-foreground-color-hue-links: 210;
--dplus-foreground-color-saturation-amount: 0.8;
--dplus-foreground-color-lightness-amount: 0.9;
}
/* Essential transparency bridge rules for the compositor layout */
#app-mount,
body,
.bg__13a2d,
.app_b1f720 {
background: transparent !important;
}
/* Enforce the exact rich violet layout across core structural UI panels */
.sidebar_e031b4,
.chatContent_a7d72e,
.container_e40c16,
.members_cbd771,
.panels_e031b4,
.wrapper_a7e7a8,
.container__2637a {
background-color: hsla(252, 28%, 19%, var(--dplus-background-color-alpha)) !important;
}
/* Soften the harsh whites into an eye-friendly Tokyo Night lavender-tinted cream */
:root, .theme-dark {
--text-normal: #c0caf5 !important;
--text-muted: #a9b1d6 !important;
--header-primary: #c0caf5 !important;
--header-secondary: #a9b1d6 !important;
--channels-default: #a9b1d6 !important;
--interactive-normal: #a9b1d6 !important;
--interactive-hover: #c0caf5 !important;
--interactive-active: #ffffff !important;
/* Subtler, low-opacity brand variables to keep buttons and accents soft */
--brand-experiment: hsla(275, 35%, 48%, 0.35) !important; /* Main buttons, toggles, badges */
--brand-experiment-560: hsla(275, 35%, 44%, 0.50) !important; /* Hover states on items */
--brand-experiment-30a: hsla(275, 35%, 48%, 0.15) !important; /* Extremely muted backfills */
--brand-experiment-20a: hsla(275, 35%, 48%, 0.10) !important;
/* Muted mention blocks that won't jump out aggressively */
--mention-background: hsla(275, 35%, 48%, 0.22) !important;
}
:root {
--dplus-font-ui: 'JetBrainsMono Nerd Font', 'Noto Sans';
--dplus-font-body: 'JetBrainsMono Nerd Font', 'Noto Sans';
--dplus-font-header: 'JetBrainsMono Nerd Font', 'Noto Sans';
--dplus-radius-ui: 11px;
--dplus-radius-avatar: 25%;
--dplus-radius-server: 25%;
--dplus-spacing-ui: 10px;
--dplus-spacing-app: 14px;
--dplus-icon-avatar-chat: 64px;
--dplus-icon-avatar-list: 32px;
--dplus-icon-avatar-profile: 80px;
}
'';
vesktop-wrapped = pkgs.runCommand "vesktop" {
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
cat << 'EOF' > $out/bin/vesktop
#!/usr/bin/env bash
# Ensure the user's Vesktop theme directory exists
THEME_DIR="$HOME/.config/vesktop/themes"
mkdir -p "$THEME_DIR"
# Remove the old symlink if it exists so cp doesn't get confused
rm -f "$THEME_DIR/nix-managed.theme.css"
# Copy the Nix-managed theme file directly so Vencord's file watcher can read it
cp "${discordTheme}" "$THEME_DIR/nix-managed.theme.css"
chmod +w "$THEME_DIR/nix-managed.theme.css"
# Launch Vesktop with the Windows User-Agent bypass
exec ${pkgs.vesktop}/bin/vesktop --user-agent-os 'windows' "$@"
EOF
chmod +x $out/bin/vesktop
# Handle the .desktop shortcuts so app launchers use our new script
if [ -d "${pkgs.vesktop}/share" ]; then
mkdir -p $out/share
cp -r ${pkgs.vesktop}/share/* $out/share/
chmod -R +w $out/share
sed -i "s|${pkgs.vesktop}/bin/vesktop|$out/bin/vesktop|g" $out/share/applications/*.desktop 2>/dev/null || true
sed -i "s|Exec=vesktop|Exec=$out/bin/vesktop|g" $out/share/applications/*.desktop 2>/dev/null || true
fi
'';
in [
vesktop-wrapped
];
};
}