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 <noreply@anthropic.com>
This commit is contained in:
ediblerope 2026-04-16 20:17:38 +01:00
parent 7d50716bc6
commit 2096330eb8
6 changed files with 171 additions and 4 deletions

View file

@ -14,9 +14,21 @@
{ 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"
'';
}

View file

@ -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} "$@"

View file

@ -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";

View file

@ -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 = ''

54
templates/btop.theme Normal file
View file

@ -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}}"

69
templates/homepage.css Normal file
View file

@ -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}};
}