fix(nb): escape % in brightnessctl battery udev rule #116

Merged
dominik.polakovics merged 1 commit from fix/nb-udev-brightnessctl-percent into main 2026-06-07 10:11:25 +02:00

Fixes a build-time failure on nb's 26.05 upgrade.

Root cause

NixOS 26.05 (systemd 260) runs udevadm verify as a build-time gate on the assembled udev rules. nb's on-battery rule contained a bare %:

.../udev-rules/99-local.rules:4 Invalid value ".../brightnessctl set 40%" for RUN
  (char 89: invalid substitution type), ignoring.
99-local.rules: udev rules check failed.

udev treats % as a format-specifier introducer, so 40% is invalid. That fails udev-rules.drvsystem-unitsetc → the whole nixos-system-nb-01-26.05 build (the cascade seen in bento-upgrade logs).

Regression from #114 (light→brightnessctl): the old light -S 40 had no %. Eval (test-configuration) cannot catch this — udevadm verify only runs at build time.

Fix

brightnessctl set 40%% — udev expands %%%, so brightnessctl still receives 40%. Added a comment so it is not reverted.

Verification

Built nb's udev-rules derivation locally with the fix: 49 udev rules files checked, Success: 49, Fail: 0 (was Fail: 1). Pre-commit eval green (nb-only change).

Relates to #102 (nb 26.05 reboot/verify).

Fixes a build-time failure on nb's 26.05 upgrade. ## Root cause NixOS 26.05 (systemd 260) runs `udevadm verify` as a **build-time gate** on the assembled udev rules. nb's on-battery rule contained a bare `%`: ``` .../udev-rules/99-local.rules:4 Invalid value ".../brightnessctl set 40%" for RUN (char 89: invalid substitution type), ignoring. 99-local.rules: udev rules check failed. ``` udev treats `%` as a format-specifier introducer, so `40%` is invalid. That fails `udev-rules.drv` → `system-units` → `etc` → the whole `nixos-system-nb-01-26.05` build (the cascade seen in bento-upgrade logs). Regression from #114 (light→brightnessctl): the old `light -S 40` had no `%`. Eval (`test-configuration`) cannot catch this — `udevadm verify` only runs at build time. ## Fix `brightnessctl set 40%%` — udev expands `%%`→`%`, so brightnessctl still receives `40%`. Added a comment so it is not reverted. ## Verification Built nb's `udev-rules` derivation locally with the fix: **`49 udev rules files checked, Success: 49, Fail: 0`** (was `Fail: 1`). Pre-commit eval green (nb-only change). Relates to #102 (nb 26.05 reboot/verify).
NixOS 26.05 (systemd 260) runs `udevadm verify` as a build-time gate. The on-battery rule's `brightnessctl set 40%` contains a bare %, which udev parses as a format specifier ("invalid substitution type"), failing udev-rules.drv and cascading to the whole system build. Escape it as %% so udev passes a literal 40% to brightnessctl. Regression from the #114 light->brightnessctl migration (old `light -S 40` had no %). Verified: udev-rules builds clean (49 files, 0 fail).
dominik.polakovics deleted branch fix/nb-udev-brightnessctl-percent 2026-06-07 10:11:25 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos!116
No description provided.