stylix: full migration off matugen

Flips stylix.autoEnable on so every supported target picks up colours
from the wallpaper-derived base16 palette, and tears out the per-app
matugen plumbing it replaces:

- fred.nix: drop the matugen config.toml block and the .keep files;
  move btop and ghostty to programs.* with the colour-bearing options
  removed (stylix owns those).
- gnome.nix: remove the matugen and jq packages, the hand-written
  gtk.css home.file overrides (replaced by gtk.gtk{3,4}.extraCss layered
  on top of stylix's theme), the WallpaperShell user-themes override,
  and the gtk-theme/cursor-theme/accent-color dconf entries that stylix
  now writes.
- stylix.nix: add a home.activation hook that recolours Adwaita folder
  SVGs using stylix.colors.base0D and pulls in Papirus mimetypes —
  same outcome as the old matugen post-hook but driven by stylix.
- common.nix: drop the matugen invocation from the `update` alias.

Leftover matugen-only behaviour intentionally dropped: Vesktop CSS,
the GNOME accent hue-mapping, the VSCodium colour-merge (stylix's
vscode target handles that natively). Templates in templates/ are kept
on disk for now; can be removed in a follow-up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ediblerope 2026-05-11 19:44:07 +01:00
parent 727eefb20a
commit 1bf08d2097
4 changed files with 150 additions and 163 deletions

View file

@ -8,10 +8,9 @@
image = "${inputs.self}/walls/wallpaper.png";
polarity = "dark";
# Phase 1: opt in to specific targets only. Apps currently handled by
# matugen (gtk, ghostty, zen, btop, vscodium, vesktop) keep their
# matugen-derived colors — autoEnable would clobber them.
autoEnable = false;
# Let stylix theme every target it supports. Per-target opt-outs go
# under home-manager.users.fred.stylix.targets.<x>.enable = false.
autoEnable = true;
cursor = {
package = pkgs.adwaita-icon-theme;
@ -24,8 +23,6 @@
package = pkgs.nerd-fonts.fira-mono;
name = "FiraMono Nerd Font";
};
# Used by stylix for fuzzel, waybar, mako etc. Stylix defaults this
# to DejaVu Sans which looks dated; Inter is a clean modern sans.
sansSerif = {
package = pkgs.inter;
name = "Inter";
@ -37,14 +34,97 @@
};
};
# Stylix's NixOS module auto-wires homeModules.stylix into every
# home-manager user, so we just opt into targets here.
home-manager.users.fred.stylix.targets = {
waybar.enable = true;
fuzzel.enable = true;
mako.enable = true;
hyprlock.enable = true;
hyprland.enable = true;
home-manager.users.fred = { config, lib, pkgs, ... }: {
# Folder icon recolor — was a matugen post-hook, now driven by
# stylix's base16 palette. base0D is the conventional blue/accent
# slot, which is what we want for Adwaita-style folder icons.
home.activation.recolorFolders = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
ICON_DIR="$HOME/.local/share/icons/WallpaperAdwaita"
ADWAITA="/run/current-system/sw/share/icons/Adwaita"
PAPIRUS="/run/current-system/sw/share/icons/Papirus-Dark"
PRIMARY="#${config.lib.stylix.colors.base0D}"
$DRY_RUN_CMD mkdir -p "$ICON_DIR/scalable/places"
$DRY_RUN_CMD cat > "$ICON_DIR/index.theme" << 'THEME'
[Icon Theme]
Name=WallpaperAdwaita
Comment=Adwaita with stylix-coloured folders and Papirus mimetypes
Inherits=Adwaita,hicolor
DisplayDepth=32
[scalable/places]
Size=128
MinSize=16
MaxSize=512
Type=Scalable
Context=Places
[16x16/mimetypes]
Size=16
Type=Fixed
Context=MimeTypes
[22x22/mimetypes]
Size=22
Type=Fixed
Context=MimeTypes
[32x32/mimetypes]
Size=32
Type=Fixed
Context=MimeTypes
[48x48/mimetypes]
Size=48
Type=Fixed
Context=MimeTypes
[64x64/mimetypes]
Size=64
MinSize=32
MaxSize=128
Type=Scalable
Context=MimeTypes
[96x96/mimetypes]
Size=96
MinSize=64
MaxSize=256
Type=Scalable
Context=MimeTypes
[128x128/mimetypes]
Size=128
MinSize=64
MaxSize=512
Type=Scalable
Context=MimeTypes
THEME
if [ -d "$ADWAITA/scalable/places" ]; then
for svg in "$ADWAITA/scalable/places"/*.svg; do
name=$(basename "$svg")
$DRY_RUN_CMD sed \
-e "s/#438de6/$PRIMARY/gi" \
-e "s/#62a0ea/$PRIMARY/gi" \
-e "s/#a4caee/$PRIMARY/gi" \
-e "s/#afd4ff/$PRIMARY/gi" \
-e "s/#c0d5ea/$PRIMARY/gi" \
"$svg" > "$ICON_DIR/scalable/places/$name"
done
fi
for size in 16x16 22x22 32x32 48x48 64x64 96x96 128x128; do
if [ -d "$PAPIRUS/$size/mimetypes" ]; then
$DRY_RUN_CMD rm -rf "$ICON_DIR/$size/mimetypes"
$DRY_RUN_CMD mkdir -p "$ICON_DIR/$size/mimetypes"
$DRY_RUN_CMD cp -rL "$PAPIRUS/$size/mimetypes"/* "$ICON_DIR/$size/mimetypes/"
fi
done
$DRY_RUN_CMD ${pkgs.gtk3}/bin/gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true
'';
};
};
}