Files
Nomarchy/features/desktop/nightlight.nix
Bernardo Magri 161542c420 fix(nightlight): gate hyprsunset on the toggle, drop hardcoded temperature
features/desktop/nightlight.nix previously set
`services.hyprsunset.enable = lib.mkDefault true` unconditionally and
baked the temperature (4000K when toggles.nightlight, 6500K otherwise)
into extraArgs at Nix-eval time. The toggle script bypassed systemd:
pkill on disable, `hyprctl dispatch exec hyprsunset --temperature 4000`
on enable — racing the systemd-managed instance and hardcoding 4000K
regardless of nomarchy.nightlightTemperature. The "Always enabled, we
control via IPC and state" comment was misleading: no IPC, the
temperature was rebuild-time, and the script forked a parallel
process.

Path (b) from the Later row:

  - services.hyprsunset.enable now follows config.nomarchy.toggles.
    nightlight — symmetric with services.hypridle.enable ← toggles.idle.
    Disabled toggle = no process running.
  - extraArgs always reads from config.nomarchy.nightlightTemperature.
    Drops the 6500K neutralising fork; when off the unit just doesn't
    start.
  - nomarchy-toggle-nightlight flips the running systemd user unit via
    `systemctl --user start/stop hyprsunset.service` for instant
    feedback, reads nightlightTemperature from state.json for the
    notify-send line, and writes .nightlight back to state.json so the
    next rebuild realigns services.hyprsunset.enable.

`nix flake check --no-build` + `bash -n` clean.
2026-05-22 18:20:44 +01:00

837 B