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

@ -87,7 +87,7 @@
# Shell aliases (work in both bash and fish) # Shell aliases (work in both bash and fish)
environment.shellAliases = { environment.shellAliases = {
update = "bash -c 'set -o pipefail && OLD_SYSTEM=$(readlink /run/current-system) && sudo nixos-rebuild switch $@ --impure --flake git+https://forg.gregersen.it/rope/nixos -L --log-format internal-json 2>&1 | nom --json && nvd diff $OLD_SYSTEM /run/current-system && (command -v record-update &>/dev/null && record-update $OLD_SYSTEM /run/current-system || true) && command -v matugen &>/dev/null && matugen image ~/.local/share/backgrounds/wallpaper.png -m dark || true' --"; update = "bash -c 'set -o pipefail && OLD_SYSTEM=$(readlink /run/current-system) && sudo nixos-rebuild switch $@ --impure --flake git+https://forg.gregersen.it/rope/nixos -L --log-format internal-json 2>&1 | nom --json && nvd diff $OLD_SYSTEM /run/current-system && (command -v record-update &>/dev/null && record-update $OLD_SYSTEM /run/current-system || true)' --";
clean = "sudo nix-collect-garbage -d"; clean = "sudo nix-collect-garbage -d";
ll = "ls -alh"; ll = "ls -alh";
clear = "command clear"; clear = "command clear";

View file

@ -1,104 +1,49 @@
# settings/fred.nix # home-manager/fred.nix
{ config, pkgs, lib, inputs, osConfig, ... }: { config, pkgs, lib, inputs, osConfig, ... }:
let let
isDesktop = lib.elem osConfig.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]; isDesktop = lib.elem osConfig.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ];
in in
{ {
# Define the state version for Home Manager
home.stateVersion = "25.11"; home.stateVersion = "25.11";
# Packages for user
home.packages = with pkgs; [ home.packages = with pkgs; [
# #
]; ];
# Allow unfree nix-shell maybe
home.file.".config/nixpkgs/config.nix".text = '' home.file.".config/nixpkgs/config.nix".text = ''
{ allowUnfree = true; } { allowUnfree = true; }
''; '';
# Wallpaper — source of truth for matugen on all hosts # Wallpaper source — consumed by stylix's image option (set in
# settings/stylix.nix) and by hyprpaper at session start.
home.file.".local/share/backgrounds/wallpaper.png".source = home.file.".local/share/backgrounds/wallpaper.png".source =
"${inputs.self}/walls/wallpaper.png"; "${inputs.self}/walls/wallpaper.png";
# Ensure Ghostty themes directory exists for matugen # btop — stylix's btop target writes the colour theme; we keep our
home.file.".config/ghostty/themes/.keep".text = ""; # non-colour preferences here.
programs.btop = lib.mkIf isDesktop {
# btop config — use matugen-generated theme enable = true;
home.file.".config/btop/btop.conf".force = true; settings = {
home.file.".config/btop/btop.conf".text = '' theme_background = false;
color_theme = "matugen" vim_keys = false;
theme_background = False };
vim_keys = False };
'';
home.file.".config/btop/themes/.keep".text = "";
# Ghostty config
home.file.".config/ghostty/config".force = true;
home.file.".config/ghostty/config".text = ''
font-family = FiraMono Nerd Font
font-size = 11
font-thicken = true
theme = wallpaper
window-padding-x = 10
window-padding-y = 10
window-padding-balance = true
background-opacity = 0.98
confirm-close-surface = false
gtk-titlebar = false
cursor-style = bar
cursor-style-blink = true
'';
# Matugen config — templates for wallpaper-based color generation
home.file.".config/matugen/config.toml".text = ''
[config]
reload_apps = true
reload_apps_list = { ghostty = "" }
[templates.btop]
input_path = "${inputs.self}/templates/btop.theme"
output_path = "${config.home.homeDirectory}/.config/btop/themes/matugen.theme"
'' + lib.optionalString isDesktop ''
[templates.ghostty]
input_path = "${inputs.self}/templates/ghostty-colors"
output_path = "${config.home.homeDirectory}/.config/ghostty/themes/wallpaper"
[templates.gtk4]
input_path = "${inputs.self}/templates/gtk4-colors.css"
output_path = "${config.home.homeDirectory}/.config/gtk-4.0/colors.css"
[templates.gtk3]
input_path = "${inputs.self}/templates/gtk3-colors.css"
output_path = "${config.home.homeDirectory}/.config/gtk-3.0/colors.css"
[templates.gnome-shell]
input_path = "${inputs.self}/templates/gnome-shell.css"
output_path = "${config.home.homeDirectory}/.local/share/themes/WallpaperShell/gnome-shell/gnome-shell.css"
[templates.zen]
input_path = "${inputs.self}/templates/zen-userChrome.css"
output_path = "${config.home.homeDirectory}/.zen/fraudek5.Default Profile/chrome/userChrome.css"
[templates.vscodium]
input_path = "${inputs.self}/templates/vscodium-colors.json"
output_path = "${config.home.homeDirectory}/.local/share/matugen/vscodium-colors.json"
post_hook = "jq -s '.[0] * .[1]' ${config.home.homeDirectory}/.config/VSCodium/User/settings.json ${config.home.homeDirectory}/.local/share/matugen/vscodium-colors.json > ${config.home.homeDirectory}/.config/VSCodium/User/settings.json.tmp && mv ${config.home.homeDirectory}/.config/VSCodium/User/settings.json.tmp ${config.home.homeDirectory}/.config/VSCodium/User/settings.json"
[templates.vesktop]
input_path = "${inputs.self}/templates/vesktop-quickCss.css"
output_path = "${config.home.homeDirectory}/.config/vesktop/settings/quickCss.css"
[templates.recolor-folders]
input_path = "${inputs.self}/templates/recolor-folders.sh"
output_path = "${config.home.homeDirectory}/.local/share/matugen/recolor-folders.sh"
post_hook = "bash ${config.home.homeDirectory}/.local/share/matugen/recolor-folders.sh"
'' + lib.optionalString (osConfig.networking.hostName == "FredOS-Mediaserver") ''
[templates.homepage]
input_path = "${inputs.self}/templates/homepage.css"
output_path = "/var/lib/homepage-custom-css/custom.css"
'';
# Ghostty — stylix's ghostty target writes the colour theme.
programs.ghostty = lib.mkIf isDesktop {
enable = true;
settings = {
font-family = "FiraMono Nerd Font";
font-size = 11;
font-thicken = true;
window-padding-x = 10;
window-padding-y = 10;
window-padding-balance = true;
background-opacity = 0.98;
confirm-close-surface = false;
gtk-titlebar = false;
cursor-style = "bar";
cursor-style-blink = true;
};
};
} }

View file

@ -18,15 +18,10 @@
gnomeExtensions.just-perfection gnomeExtensions.just-perfection
gnomeExtensions.appindicator gnomeExtensions.appindicator
gnomeExtensions.hot-edge gnomeExtensions.hot-edge
gnomeExtensions.user-themes
#gnomeExtensions.rounded-window-corners-reborn
adwaita-icon-theme adwaita-icon-theme
gnome-themes-extra gnome-themes-extra
adwaita-icon-theme-legacy adwaita-icon-theme-legacy
papirus-icon-theme papirus-icon-theme
adw-gtk3
matugen
jq
]; ];
# Set cursor theme # Set cursor theme
@ -40,12 +35,11 @@
]; ];
}; };
# Set icon theme via dconf # mutter VRR — stylix handles theme/icon dconf entries
programs.dconf.profiles.user.databases = [{ programs.dconf.profiles.user.databases = [{
settings = { settings = {
"org/gnome/desktop/interface" = { "org/gnome/desktop/interface" = {
icon-theme = "WallpaperAdwaita"; icon-theme = "WallpaperAdwaita";
cursor-theme = "Adwaita";
}; };
"org/gnome/mutter" = { "org/gnome/mutter" = {
experimental-features = [ "variable-refresh-rate" ]; experimental-features = [ "variable-refresh-rate" ];
@ -63,61 +57,34 @@
programs.dconf.enable = true; programs.dconf.enable = true;
# Home Manager GNOME settings # Home Manager GNOME settings
home-manager.users.fred = { config, lib, ... }: { home-manager.users.fred = { config, lib, pkgs, ... }: {
# Minimal titlebars — hide window buttons and shrink headerbar # Minimal titlebars — stylix manages the GTK theme; we layer our
home.file.".config/gtk-4.0/gtk.css".force = true; # headerbar shrink on top via programs.gtk.*.extraCss.
home.file.".config/gtk-4.0/gtk.css".text = '' gtk = {
@import url("colors.css"); enable = true;
headerbar { gtk3.extraCss = ''
min-height: 0; headerbar { min-height: 0; padding: 0; margin: 0; }
padding: 0; headerbar .title { font-size: 0; }
margin: 0; '';
} gtk4.extraCss = ''
headerbar .title { headerbar { min-height: 0; padding: 0; margin: 0; }
font-size: 0; headerbar .title { font-size: 0; }
} window:backdrop {
/* Keep wallpaper colors when window loses focus */ background-color: @window_bg_color;
window:backdrop { color: @window_fg_color;
background-color: @window_bg_color; }
color: @window_fg_color; window:backdrop headerbar {
} background-color: @headerbar_bg_color;
window:backdrop headerbar { color: @headerbar_fg_color;
background-color: @headerbar_bg_color; }
color: @headerbar_fg_color; '';
} };
window:backdrop .navigation-sidebar,
window:backdrop .sidebar-pane {
background-color: @sidebar_bg_color;
color: @sidebar_fg_color;
}
window:backdrop .top-bar {
background-color: @headerbar_bg_color;
color: @headerbar_fg_color;
}
'';
home.file.".config/gtk-3.0/gtk.css".force = true;
home.file.".config/gtk-3.0/gtk.css".text = ''
@import url("colors.css");
headerbar {
min-height: 0;
padding: 0;
margin: 0;
}
headerbar .title {
font-size: 0;
}
'';
# GNOME dconf settings # GNOME dconf settings — stylix owns colour-scheme, gtk-theme,
# cursor-theme and accent-color now.
dconf.settings = { dconf.settings = {
# Interface / theme
"org/gnome/desktop/interface" = { "org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
gtk-theme = "adw-gtk3-dark";
enable-hot-corners = false; enable-hot-corners = false;
accent-color = "purple";
cursor-theme = "Adwaita";
cursor-size = 24;
}; };
# Wallpaper settings # Wallpaper settings
@ -174,11 +141,6 @@
"org/gnome/shell/extensions/just-perfection" = { "org/gnome/shell/extensions/just-perfection" = {
window-demands-attention-focus = true; window-demands-attention-focus = true;
}; };
# User themes extension — load wallpaper shell theme
"org/gnome/shell/extensions/user-theme" = {
name = "WallpaperShell";
};
}; };
}; };
}; };

View file

@ -8,10 +8,9 @@
image = "${inputs.self}/walls/wallpaper.png"; image = "${inputs.self}/walls/wallpaper.png";
polarity = "dark"; polarity = "dark";
# Phase 1: opt in to specific targets only. Apps currently handled by # Let stylix theme every target it supports. Per-target opt-outs go
# matugen (gtk, ghostty, zen, btop, vscodium, vesktop) keep their # under home-manager.users.fred.stylix.targets.<x>.enable = false.
# matugen-derived colors — autoEnable would clobber them. autoEnable = true;
autoEnable = false;
cursor = { cursor = {
package = pkgs.adwaita-icon-theme; package = pkgs.adwaita-icon-theme;
@ -24,8 +23,6 @@
package = pkgs.nerd-fonts.fira-mono; package = pkgs.nerd-fonts.fira-mono;
name = "FiraMono Nerd Font"; 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 = { sansSerif = {
package = pkgs.inter; package = pkgs.inter;
name = "Inter"; name = "Inter";
@ -37,14 +34,97 @@
}; };
}; };
# Stylix's NixOS module auto-wires homeModules.stylix into every home-manager.users.fred = { config, lib, pkgs, ... }: {
# home-manager user, so we just opt into targets here. # Folder icon recolor — was a matugen post-hook, now driven by
home-manager.users.fred.stylix.targets = { # stylix's base16 palette. base0D is the conventional blue/accent
waybar.enable = true; # slot, which is what we want for Adwaita-style folder icons.
fuzzel.enable = true; home.activation.recolorFolders = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mako.enable = true; ICON_DIR="$HOME/.local/share/icons/WallpaperAdwaita"
hyprlock.enable = true; ADWAITA="/run/current-system/sw/share/icons/Adwaita"
hyprland.enable = true; 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
'';
}; };
}; };
} }