nixos/settings/stylix.nix
ediblerope 1bf08d2097 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>
2026-05-11 19:44:19 +01:00

130 lines
3.6 KiB
Nix

{ config, pkgs, lib, inputs, ... }:
{
imports = [ inputs.stylix.nixosModules.stylix ];
config = lib.mkIf (lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]) {
stylix = {
enable = true;
image = "${inputs.self}/walls/wallpaper.png";
polarity = "dark";
# 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;
name = "Adwaita";
size = 24;
};
fonts = {
monospace = {
package = pkgs.nerd-fonts.fira-mono;
name = "FiraMono Nerd Font";
};
sansSerif = {
package = pkgs.inter;
name = "Inter";
};
serif = {
package = pkgs.inter;
name = "Inter";
};
};
};
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
'';
};
};
}