From 1bf08d20975617df202bafa341ce761ebd3d1eb5 Mon Sep 17 00:00:00 2001 From: ediblerope Date: Mon, 11 May 2026 19:44:07 +0100 Subject: [PATCH] stylix: full migration off matugen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- common.nix | 2 +- home-manager/fred.nix | 115 +++++++++++------------------------------- settings/gnome.nix | 88 +++++++++----------------------- settings/stylix.nix | 108 ++++++++++++++++++++++++++++++++++----- 4 files changed, 150 insertions(+), 163 deletions(-) diff --git a/common.nix b/common.nix index 3164ccb..5233d6a 100644 --- a/common.nix +++ b/common.nix @@ -87,7 +87,7 @@ # Shell aliases (work in both bash and fish) 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"; ll = "ls -alh"; clear = "command clear"; diff --git a/home-manager/fred.nix b/home-manager/fred.nix index aba4dff..0b70a93 100644 --- a/home-manager/fred.nix +++ b/home-manager/fred.nix @@ -1,104 +1,49 @@ -# settings/fred.nix +# home-manager/fred.nix { config, pkgs, lib, inputs, osConfig, ... }: let isDesktop = lib.elem osConfig.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]; in { - # Define the state version for Home Manager home.stateVersion = "25.11"; - - # Packages for user + home.packages = with pkgs; [ # ]; - # Allow unfree nix-shell maybe home.file.".config/nixpkgs/config.nix".text = '' { 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 = "${inputs.self}/walls/wallpaper.png"; - # Ensure Ghostty themes directory exists for matugen - home.file.".config/ghostty/themes/.keep".text = ""; - - # btop config — use matugen-generated theme - home.file.".config/btop/btop.conf".force = true; - home.file.".config/btop/btop.conf".text = '' - color_theme = "matugen" - 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" - ''; + # btop — stylix's btop target writes the colour theme; we keep our + # non-colour preferences here. + programs.btop = lib.mkIf isDesktop { + enable = true; + settings = { + theme_background = false; + vim_keys = false; + }; + }; + # 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; + }; + }; } diff --git a/settings/gnome.nix b/settings/gnome.nix index fc2d709..87d584c 100644 --- a/settings/gnome.nix +++ b/settings/gnome.nix @@ -18,15 +18,10 @@ gnomeExtensions.just-perfection gnomeExtensions.appindicator gnomeExtensions.hot-edge - gnomeExtensions.user-themes - #gnomeExtensions.rounded-window-corners-reborn adwaita-icon-theme gnome-themes-extra adwaita-icon-theme-legacy papirus-icon-theme - adw-gtk3 - matugen - jq ]; # 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 = [{ settings = { "org/gnome/desktop/interface" = { icon-theme = "WallpaperAdwaita"; - cursor-theme = "Adwaita"; }; "org/gnome/mutter" = { experimental-features = [ "variable-refresh-rate" ]; @@ -63,61 +57,34 @@ programs.dconf.enable = true; # Home Manager GNOME settings - home-manager.users.fred = { config, lib, ... }: { - # Minimal titlebars — hide window buttons and shrink headerbar - home.file.".config/gtk-4.0/gtk.css".force = true; - home.file.".config/gtk-4.0/gtk.css".text = '' - @import url("colors.css"); - headerbar { - min-height: 0; - padding: 0; - margin: 0; - } - headerbar .title { - font-size: 0; - } - /* Keep wallpaper colors when window loses focus */ - window:backdrop { - background-color: @window_bg_color; - color: @window_fg_color; - } - window:backdrop headerbar { - 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; - } - ''; + home-manager.users.fred = { config, lib, pkgs, ... }: { + # Minimal titlebars — stylix manages the GTK theme; we layer our + # headerbar shrink on top via programs.gtk.*.extraCss. + gtk = { + enable = true; + gtk3.extraCss = '' + headerbar { min-height: 0; padding: 0; margin: 0; } + headerbar .title { font-size: 0; } + ''; + gtk4.extraCss = '' + headerbar { min-height: 0; padding: 0; margin: 0; } + headerbar .title { font-size: 0; } + window:backdrop { + background-color: @window_bg_color; + color: @window_fg_color; + } + window:backdrop headerbar { + background-color: @headerbar_bg_color; + color: @headerbar_fg_color; + } + ''; + }; - # GNOME dconf settings + # GNOME dconf settings — stylix owns colour-scheme, gtk-theme, + # cursor-theme and accent-color now. dconf.settings = { - # Interface / theme "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - gtk-theme = "adw-gtk3-dark"; enable-hot-corners = false; - accent-color = "purple"; - cursor-theme = "Adwaita"; - cursor-size = 24; }; # Wallpaper settings @@ -174,11 +141,6 @@ "org/gnome/shell/extensions/just-perfection" = { window-demands-attention-focus = true; }; - - # User themes extension — load wallpaper shell theme - "org/gnome/shell/extensions/user-theme" = { - name = "WallpaperShell"; - }; }; }; }; diff --git a/settings/stylix.nix b/settings/stylix.nix index 7ae3578..7a0c34e 100644 --- a/settings/stylix.nix +++ b/settings/stylix.nix @@ -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..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 + ''; }; }; }