From 2096330eb8402fd546a0249982785bf445b5060c Mon Sep 17 00:00:00 2001 From: ediblerope Date: Thu, 16 Apr 2026 20:17:38 +0100 Subject: [PATCH] Theme btop and Homepage via matugen on the mediaserver Share the wallpaper symlink across all hosts by moving it from gnome.nix into home-manager/fred.nix, and add matugen templates for btop and the Homepage dashboard. The Homepage NixOS module writes custom.css into /etc (read-only), so bind-mount /var/lib/homepage-custom-css/custom.css over it. A systemd path unit restarts homepage-dashboard whenever matugen rewrites the file, so regeneration works without sudo. Co-Authored-By: Claude Opus 4.6 --- home-manager/fred.nix | 22 +++++++++++- hosts/FredOS-Mediaserver.nix | 1 + services/homepage.nix | 26 ++++++++++++++ settings/gnome.nix | 3 -- templates/btop.theme | 54 ++++++++++++++++++++++++++++ templates/homepage.css | 69 ++++++++++++++++++++++++++++++++++++ 6 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 templates/btop.theme create mode 100644 templates/homepage.css diff --git a/home-manager/fred.nix b/home-manager/fred.nix index 8a1bed9..36aebb9 100644 --- a/home-manager/fred.nix +++ b/home-manager/fred.nix @@ -13,10 +13,22 @@ home.file.".config/nixpkgs/config.nix".text = '' { allowUnfree = true; } ''; - + + # Wallpaper — source of truth for matugen on all hosts + 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".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 = '' @@ -73,6 +85,14 @@ 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" + + [templates.btop] + input_path = "${inputs.self}/templates/btop.theme" + output_path = "${config.home.homeDirectory}/.config/btop/themes/matugen.theme" + + [templates.homepage] + input_path = "${inputs.self}/templates/homepage.css" + output_path = "/var/lib/homepage-custom-css/custom.css" ''; } diff --git a/hosts/FredOS-Mediaserver.nix b/hosts/FredOS-Mediaserver.nix index 8badcf2..9581afb 100644 --- a/hosts/FredOS-Mediaserver.nix +++ b/hosts/FredOS-Mediaserver.nix @@ -17,6 +17,7 @@ screen yt-dlp ghostty.terminfo + matugen (pkgs.writeShellScriptBin "transcode-hevc" '' export PATH="${pkgs.jellyfin-ffmpeg}/bin:${pkgs.coreutils}/bin:${pkgs.findutils}/bin:${pkgs.gnugrep}/bin:${pkgs.gawk}/bin:${pkgs.bc}/bin:${pkgs.curl}/bin:$PATH" exec ${pkgs.bash}/bin/bash ${../scripts/transcode-hevc.sh} "$@" diff --git a/services/homepage.nix b/services/homepage.nix index 2a62e53..3bf5b29 100644 --- a/services/homepage.nix +++ b/services/homepage.nix @@ -60,6 +60,32 @@ in { config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") { + # Writable location for matugen-generated custom.css; bind-mounted into + # the homepage service namespace over the Nix-managed /etc path. + systemd.tmpfiles.rules = [ + "d /var/lib/homepage-custom-css 0755 fred users -" + "f /var/lib/homepage-custom-css/custom.css 0644 fred users -" + ]; + + systemd.services.homepage-dashboard.serviceConfig.BindPaths = [ + "/var/lib/homepage-custom-css/custom.css:/etc/homepage-dashboard/custom.css" + ]; + + # Auto-restart homepage when matugen rewrites the custom.css + systemd.paths.homepage-css-reload = { + description = "Watch matugen custom.css for changes"; + wantedBy = [ "multi-user.target" ]; + pathConfig.PathChanged = "/var/lib/homepage-custom-css/custom.css"; + }; + + systemd.services.homepage-css-reload = { + description = "Restart homepage after custom.css changes"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.systemd}/bin/systemctl restart homepage-dashboard.service"; + }; + }; + # Oneshot service that extracts API keys and writes /etc/homepage-secrets systemd.services.homepage-extract-secrets = { description = "Extract API keys for Homepage dashboard"; diff --git a/settings/gnome.nix b/settings/gnome.nix index 2484b66..fc2d709 100644 --- a/settings/gnome.nix +++ b/settings/gnome.nix @@ -64,9 +64,6 @@ # Home Manager GNOME settings home-manager.users.fred = { config, lib, ... }: { - home.file.".local/share/backgrounds/wallpaper.png".source = - "${inputs.self}/walls/wallpaper.png"; - # 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 = '' diff --git a/templates/btop.theme b/templates/btop.theme new file mode 100644 index 0000000..29ad802 --- /dev/null +++ b/templates/btop.theme @@ -0,0 +1,54 @@ +# Matugen-generated btop theme based on wallpaper + +theme[main_bg]="{{colors.surface.default.hex}}" +theme[main_fg]="{{colors.on_surface.default.hex}}" +theme[title]="{{colors.on_surface.default.hex}}" +theme[hi_fg]="{{colors.primary.default.hex}}" +theme[selected_bg]="{{colors.surface_container_high.default.hex}}" +theme[selected_fg]="{{colors.primary.default.hex}}" +theme[inactive_fg]="{{colors.on_surface_variant.default.hex}}" +theme[graph_text]="{{colors.on_surface.default.hex}}" +theme[meter_bg]="{{colors.surface_container.default.hex}}" +theme[proc_misc]="{{colors.tertiary.default.hex}}" + +theme[cpu_box]="{{colors.outline.default.hex}}" +theme[mem_box]="{{colors.outline.default.hex}}" +theme[net_box]="{{colors.outline.default.hex}}" +theme[proc_box]="{{colors.outline.default.hex}}" +theme[div_line]="{{colors.outline_variant.default.hex}}" + +theme[temp_start]="{{colors.tertiary.default.hex}}" +theme[temp_mid]="{{colors.secondary.default.hex}}" +theme[temp_end]="{{colors.error.default.hex}}" + +theme[cpu_start]="{{colors.primary.default.hex}}" +theme[cpu_mid]="{{colors.secondary.default.hex}}" +theme[cpu_end]="{{colors.tertiary.default.hex}}" + +theme[free_start]="{{colors.primary.default.hex}}" +theme[free_mid]="{{colors.secondary.default.hex}}" +theme[free_end]="{{colors.tertiary.default.hex}}" + +theme[cached_start]="{{colors.primary.default.hex}}" +theme[cached_mid]="{{colors.secondary.default.hex}}" +theme[cached_end]="{{colors.tertiary.default.hex}}" + +theme[available_start]="{{colors.primary.default.hex}}" +theme[available_mid]="{{colors.secondary.default.hex}}" +theme[available_end]="{{colors.tertiary.default.hex}}" + +theme[used_start]="{{colors.primary.default.hex}}" +theme[used_mid]="{{colors.secondary.default.hex}}" +theme[used_end]="{{colors.tertiary.default.hex}}" + +theme[download_start]="{{colors.primary.default.hex}}" +theme[download_mid]="{{colors.secondary.default.hex}}" +theme[download_end]="{{colors.tertiary.default.hex}}" + +theme[upload_start]="{{colors.primary.default.hex}}" +theme[upload_mid]="{{colors.secondary.default.hex}}" +theme[upload_end]="{{colors.tertiary.default.hex}}" + +theme[process_start]="{{colors.primary.default.hex}}" +theme[process_mid]="{{colors.secondary.default.hex}}" +theme[process_end]="{{colors.tertiary.default.hex}}" diff --git a/templates/homepage.css b/templates/homepage.css new file mode 100644 index 0000000..b610470 --- /dev/null +++ b/templates/homepage.css @@ -0,0 +1,69 @@ +/* Matugen-generated Homepage theme based on wallpaper */ + +/* Background + text for the whole dashboard */ +html, body, main, .information-widget { + background-color: {{colors.surface.default.hex}} !important; + color: {{colors.on_surface.default.hex}} !important; +} + +/* Service and widget cards */ +#information-widgets > *, +.services-group .service, +.bookmark-group .bookmark, +.information-widget-datetime, +.information-widget-resources, +.information-widget-search { + background-color: {{colors.surface_container.default.hex}} !important; + color: {{colors.on_surface.default.hex}} !important; + border-color: {{colors.outline_variant.default.hex}} !important; +} + +/* Group headings */ +h1, h2, h3, .services-group h2, .bookmark-group h2 { + color: {{colors.on_surface.default.hex}} !important; +} + +/* Muted / secondary text */ +.service-description, .bookmark-description, +.service .service-sub, .information-widget .label { + color: {{colors.on_surface_variant.default.hex}} !important; +} + +/* Search input */ +input, .search input[type="text"] { + background-color: {{colors.surface_container_high.default.hex}} !important; + color: {{colors.on_surface.default.hex}} !important; + border-color: {{colors.outline.default.hex}} !important; +} + +/* Accent — used on highlights, progress bars, links */ +a, .service a:hover, .bookmark a:hover, +.resources .resource .progress .progress-bar, +button:hover, .service-container:hover { + color: {{colors.primary.default.hex}} !important; +} + +.resources .resource .progress .progress-bar, +.resources .resource .usage-bar-fill { + background-color: {{colors.primary.default.hex}} !important; +} + +/* Dividers */ +hr, .service-container, .bookmark-container { + border-color: {{colors.outline_variant.default.hex}} !important; +} + +/* Override Tailwind's slate palette so built-in theme uses wallpaper colors */ +:root { + --color-slate-50: {{colors.on_surface.default.hex}}; + --color-slate-100: {{colors.on_surface.default.hex}}; + --color-slate-200: {{colors.on_surface.default.hex}}; + --color-slate-300: {{colors.on_surface_variant.default.hex}}; + --color-slate-400: {{colors.on_surface_variant.default.hex}}; + --color-slate-500: {{colors.outline.default.hex}}; + --color-slate-600: {{colors.outline_variant.default.hex}}; + --color-slate-700: {{colors.surface_container_high.default.hex}}; + --color-slate-800: {{colors.surface_container.default.hex}}; + --color-slate-900: {{colors.surface.default.hex}}; + --color-slate-950: {{colors.surface.default.hex}}; +}