feat(themes): wallpapers split — 94 MB of runtime-only images leave the flake source
All checks were successful
Check / eval (push) Successful in 4m1s
All checks were successful
Check / eval (push) Successful in 4m1s
The split line is consumption time: palette JSONs, previews and per-theme overrides are read at Nix eval and stay in-repo (~3 MB); wallpapers are runtime-only (swww via nomarchy-state-sync, never read at eval) and move to the pinned nomarchy-wallpapers non-flake input (git.bemagri.xyz/bernardo/Nomarchy-Wallpapers @ 803b48d, all 24 slugs). New overlay drv nomarchy-default-themes merges the two: repo themes copied, <slug>/backgrounds symlinked from the input, build FAILS if any theme JSON lacks non-empty backgrounds — the drift guard for the two-repo dance. nomarchy-state-sync's wrapper now points straight at the merged store path (no in-package copy): the package drops from ~94 MB to 32.6 KiB and the wallpapers source appears exactly once in any system closure, ISO included — offline promise intact. Downstream custom wallpapers still win ($NOMARCHY_PATH/themes is checked first), and an explicit state.json wallpaper path still works. checks re-pointed at the merged tree (theme-wholeswap, state-sync-validate, auto-theme); theme-contrast and airplane stay on ./themes (JSON/text only). import-palettes.py + README updated; ROADMAP § Faster switches marked shipped; LATER now carries only the pre-built-variants follow-on. Also files #151 (v1 launch plan, [human]) with measured history numbers: the 107 MiB pack is 94 MB wallpaper blobs; all 848 text commits pack to ~15-20 MiB — recommendation recorded to filter-repo at the GitHub move, not fresh-start. Verification: V2 — nix flake check --no-build green; theme-wholeswap, state-sync-validate, auto-theme VM check, downstream-template-home all green; wallpapers store path exactly once in the state-sync closure; `list` works from a scratch state dir. V3 queued: live wallpaper render + bg-next + custom-override precedence after next pull (HARDWARE-QUEUE). Lock gained exactly the one input node. Implementation by a Sonnet subagent; design and review on Fable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
60
flake.nix
60
flake.nix
@@ -30,9 +30,20 @@
|
||||
url = "github:NixOS/nixos-hardware/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Wallpapers only — split out of this repo (ROADMAP § "Faster
|
||||
# switches") so a `state.json` write stops re-copying ~94 MB of
|
||||
# backgrounds/ before Nix can evaluate a 1 KB change. Runtime-only:
|
||||
# never read at eval, only by nomarchy-state-sync's Python (swww
|
||||
# path) via NOMARCHY_DEFAULT_THEMES. `flake = false` — it's just a
|
||||
# content tree (`<slug>/backgrounds/*`), not a flake.
|
||||
nomarchy-wallpapers = {
|
||||
url = "git+https://git.bemagri.xyz/bernardo/Nomarchy-Wallpapers.git?ref=main";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, stylix, nixos-hardware, ... }:
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, stylix, nixos-hardware, nomarchy-wallpapers, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
username = "nomarchy"; # reference host only; downstream picks its own
|
||||
@@ -95,10 +106,43 @@
|
||||
inherit (prev.stdenv.hostPlatform) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
# The default themes root: this repo's ./themes (JSONs, previews,
|
||||
# btop/waybar/rofi overrides — ~3 MB post wallpaper-split) merged
|
||||
# with backgrounds/ symlinked in from the pinned nomarchy-wallpapers
|
||||
# input. One tree so nomarchy-state-sync (baked-in fallback) and
|
||||
# the theme-wholeswap check both see slug/backgrounds/ in the same
|
||||
# place a downstream machine would via NOMARCHY_DEFAULT_THEMES.
|
||||
nomarchy-default-themes =
|
||||
let
|
||||
wallpaperSlugs = builtins.attrNames
|
||||
(nixpkgs.lib.filterAttrs (n: t: t == "directory")
|
||||
(builtins.readDir nomarchy-wallpapers));
|
||||
linkBackgrounds = slug: ''
|
||||
if [ -d ${nomarchy-wallpapers}/${slug}/backgrounds ]; then
|
||||
mkdir -p $out/${slug}
|
||||
ln -s ${nomarchy-wallpapers}/${slug}/backgrounds $out/${slug}/backgrounds
|
||||
fi
|
||||
'';
|
||||
in
|
||||
final.runCommand "nomarchy-default-themes" { } ''
|
||||
cp -r ${./themes} $out
|
||||
chmod -R u+w $out
|
||||
|
||||
${nixpkgs.lib.concatMapStringsSep "\n" linkBackgrounds wallpaperSlugs}
|
||||
|
||||
for j in $out/*.json; do
|
||||
slug=$(basename "$j" .json)
|
||||
if [ ! -d "$out/$slug/backgrounds" ] || [ -z "$(ls -A "$out/$slug/backgrounds" 2>/dev/null)" ]; then
|
||||
echo "nomarchy-default-themes: $slug has no non-empty backgrounds/ (drift vs nomarchy-wallpapers)" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
'';
|
||||
nomarchy-state-sync = final.callPackage ./pkgs/nomarchy-state-sync {
|
||||
# Presets baked into the package, so `nomarchy-state-sync list`
|
||||
# works on machines that don't check out this repo.
|
||||
themesDir = ./themes;
|
||||
# works on machines that don't check out this repo. Already a
|
||||
# store artifact (nomarchy-default-themes) — no copy needed.
|
||||
themesDir = final.nomarchy-default-themes;
|
||||
};
|
||||
nomarchy-doctor = final.callPackage ./pkgs/nomarchy-doctor { };
|
||||
nomarchy-battery-notify = final.callPackage ./pkgs/nomarchy-battery-notify { };
|
||||
@@ -336,11 +380,13 @@
|
||||
# Whole-swap waybar.css is read raw (no palette prepend) — every
|
||||
# @color it references must be @define-color'd in the same file
|
||||
# (neon-glass shipped zero defines; BACKLOG #62). Also gate
|
||||
# preview.png + non-empty backgrounds/ per preset.
|
||||
# preview.png + non-empty backgrounds/ per preset — run against
|
||||
# the merged tree (pkgs.nomarchy-default-themes) so this doubles
|
||||
# as the drift guard between this repo and nomarchy-wallpapers.
|
||||
theme-wholeswap = pkgs.runCommand "nomarchy-theme-wholeswap"
|
||||
{ nativeBuildInputs = [ pkgs.python3 ]; }
|
||||
''
|
||||
python3 ${./tools/check-theme-wholeswap.py} ${./themes}
|
||||
python3 ${./tools/check-theme-wholeswap.py} ${pkgs.nomarchy-default-themes}
|
||||
touch $out
|
||||
'';
|
||||
|
||||
@@ -389,7 +435,7 @@
|
||||
''
|
||||
set -eu
|
||||
tool=${./pkgs/nomarchy-state-sync/nomarchy-state-sync.py}
|
||||
export NOMARCHY_DEFAULT_THEMES=${./themes}
|
||||
export NOMARCHY_DEFAULT_THEMES=${pkgs.nomarchy-default-themes}
|
||||
|
||||
mkdir good && cp ${./templates/downstream/state.json} good/state.json
|
||||
chmod +w good/state.json
|
||||
@@ -2180,7 +2226,7 @@
|
||||
)
|
||||
|
||||
env = ("NOMARCHY_PATH=/root/.nomarchy "
|
||||
"NOMARCHY_DEFAULT_THEMES=${./themes} "
|
||||
"NOMARCHY_DEFAULT_THEMES=${pkgs.nomarchy-default-themes} "
|
||||
"NOMARCHY_REBUILD=/root/rebuild ")
|
||||
|
||||
# Pair + schedule (setup writes only, no rebuild).
|
||||
|
||||
Reference in New Issue
Block a user