Files
Nomarchy/pkgs/nomarchy-theme-sync/default.nix
Bernardo Magri f211ef0d09 feat: Nomarchy ground-up rewrite on NixOS 26.05
Full replacement of the previous iteration, rebuilt around three ideas:

- Pure evaluation: theme-state.json lives inside the flake and is read
  via the nomarchy.stateFile option — no --impure, ever.
- All-Home-Manager theming: `nomarchy-theme-sync apply` writes the JSON
  and runs `home-manager switch`; every theme change is one atomic,
  rollbackable generation. Wallpaper (swww) is the sole runtime piece.
- Flat, downstream-first layout: modules/{nixos,home} with one
  options.nix each, exported as nixosModules/homeModules + overlay +
  flake template; system (nixos-rebuild) and desktop (home-manager
  switch) rebuild paths are fully split.

Ships 21 themes imported from the previous iteration (palettes,
wallpapers, btop themes, six whole-swap Waybar identities), Stylix for
the GTK/Qt/cursor long tail, a live ISO target with offline theme
switching, and docs/TESTING.md with the QEMU verification workflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 10:59:13 +01:00

50 lines
1.3 KiB
Nix

{ lib
, stdenvNoCC
, python3
, makeWrapper
, swww
, libnotify
, git
# Shipped theme presets, baked into the package as a fallback so
# `list`/`apply` work even when $NOMARCHY_PATH has no themes/ dir.
, themesDir ? null
}:
stdenvNoCC.mkDerivation {
pname = "nomarchy-theme-sync";
version = "0.4.0";
src = ./.;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python3 ];
installPhase = ''
runHook preInstall
install -Dm755 nomarchy-theme-sync.py $out/bin/nomarchy-theme-sync
patchShebangs $out/bin/nomarchy-theme-sync
${lib.optionalString (themesDir != null) ''
mkdir -p $out/share/nomarchy
cp -r ${themesDir} $out/share/nomarchy/themes
''}
# Stdlib-only Python. home-manager is deliberately NOT wrapped in
# the rebuild must use the user's own home-manager from their PATH.
wrapProgram $out/bin/nomarchy-theme-sync \
--prefix PATH : ${lib.makeBinPath [ swww libnotify git ]} \
${lib.optionalString (themesDir != null)
"--set NOMARCHY_DEFAULT_THEMES $out/share/nomarchy/themes"}
runHook postInstall
'';
meta = {
description = "Nomarchy theming: JSON state writer + Home Manager rebuild dispatcher";
license = lib.licenses.mit;
mainProgram = "nomarchy-theme-sync";
platforms = lib.platforms.linux;
};
}