The gamescope prune can't delete reshade — it installs under read-only directories #336

Merged
enricobuehler merged 1 commits from gamescope-prune-writable into main 2026-08-19 14:42:34 +00:00
Owner

Third fault in this install path, reachable only now that #332 got the build past the layer assertion. The compositor builds, links and installs — then the prune dies on every reshade file:

rm: cannot remove '.../share/gamescope/reshade/Shaders/lilium__tone_mapping.fx': Permission denied
rm: cannot remove '.../share/gamescope/reshade/Textures/lilium__cie_1931.png': Permission denied
…30 more

Cause

postInstall prunes everything but bin:

find $out -mindepth 1 -maxdepth 1 ! -name bin -exec rm -rf {} +

gamescope's own default_extras_install.sh installs the reshade shaders and textures under read-only directories (mode 555). rm needs write permission on the containing directory, not on the file, so every unlink fails. rm -rf doesn't help — -f suppresses missing-file errors, not permission ones.

chmod -R u+w $out before the prune. Nix seals $out read-only after the builder exits, so widening it mid-build costs nothing and changes nothing in the output.

Verification status

  • nix flake check passes.
  • ⚠️ Not verified end-to-end. The dispatch has now been blocked before reaching gamescope four times by the punktfunk-web OOM at the unconditional bun step. The diagnosis here is read directly off run 19341's log rather than inferred, but I haven't watched this specific change build green and won't claim otherwise.

The real blocker now

The punktfunk-web OOM (bun run build SIGKILL, exit 137) has blocked more runs today than every real bug combined. It is no longer an occasional annoyance — it's the thing preventing verification of anything in this file, on the exact build-gamescope path the header prescribes for checking compositor changes.

One cheap mitigation worth trying: the bun step builds punktfunk-web and punktfunk-scripting in a single nix build, so nix may run both memory-hungry bundlers concurrently. --max-jobs 1 would serialise them and roughly halve peak memory, at almost no cost (it limits parallel derivations, not cores within one). Happy to put that up separately — it's a different concern from this fix.

The pattern worth noticing

Three latent faults stacked in one install path — patch drift (#328), enableWsi defaulting off (#332), and this — each masking the next, each costing a full compositor build to reach. That's the signature of a path that has never once completed end-to-end on nix, and the argument for the cache tier compiling gamescope on every push to main rather than leaving it a dispatch opt-in.

Third fault in this install path, reachable only now that #332 got the build past the layer assertion. The compositor builds, links and installs — then the prune dies on every reshade file: ``` rm: cannot remove '.../share/gamescope/reshade/Shaders/lilium__tone_mapping.fx': Permission denied rm: cannot remove '.../share/gamescope/reshade/Textures/lilium__cie_1931.png': Permission denied …30 more ``` ## Cause `postInstall` prunes everything but `bin`: ```sh find $out -mindepth 1 -maxdepth 1 ! -name bin -exec rm -rf {} + ``` gamescope's own `default_extras_install.sh` installs the reshade shaders and textures under **read-only directories** (mode 555). `rm` needs write permission on the *containing directory*, not on the file, so every unlink fails. `rm -rf` doesn't help — `-f` suppresses missing-file errors, not permission ones. `chmod -R u+w $out` before the prune. Nix seals `$out` read-only after the builder exits, so widening it mid-build costs nothing and changes nothing in the output. ## Verification status - ✅ `nix flake check` passes. - ⚠️ **Not verified end-to-end.** The dispatch has now been blocked *before* reaching gamescope **four times** by the `punktfunk-web` OOM at the unconditional bun step. The diagnosis here is read directly off run 19341's log rather than inferred, but I haven't watched this specific change build green and won't claim otherwise. ## The real blocker now The `punktfunk-web` OOM (`bun run build` SIGKILL, exit 137) has blocked more runs today than every real bug combined. It is no longer an occasional annoyance — it's the thing preventing verification of anything in this file, on the exact `build-gamescope` path the header prescribes for checking compositor changes. One cheap mitigation worth trying: the bun step builds `punktfunk-web` and `punktfunk-scripting` in a single `nix build`, so nix may run both memory-hungry bundlers concurrently. `--max-jobs 1` would serialise them and roughly halve peak memory, at almost no cost (it limits parallel *derivations*, not cores within one). Happy to put that up separately — it's a different concern from this fix. ## The pattern worth noticing Three latent faults stacked in one install path — patch drift (#328), `enableWsi` defaulting off (#332), and this — each masking the next, each costing a full compositor build to reach. That's the signature of a path that has never once completed end-to-end on nix, and the argument for the `cache` tier compiling gamescope on every push to main rather than leaving it a dispatch opt-in.
enricobuehler added 1 commit 2026-08-19 14:07:49 +00:00
fix(nix): make $out writable before the prune — reshade installs read-only
ci / bun-nix (pull_request) Successful in 25s
ci / docs-site (pull_request) Successful in 1m12s
ci / web (pull_request) Successful in 1m17s
ci / rust-arm64 (pull_request) Successful in 1m43s
ci / rust (pull_request) Successful in 5m13s
nix / flake (pull_request) Failing after 10m41s
6807d7951c
With the WSI layer building, the derivation reaches the prune and dies on every
reshade file it tries to remove:

    rm: cannot remove '.../share/gamescope/reshade/Shaders/lilium__tone_mapping.fx':
        Permission denied

gamescope's own default_extras_install.sh installs those under read-only
DIRECTORIES (mode 555), and rm needs write permission on the CONTAINING
directory rather than on the file. The compositor is fully built and installed
by that point, so the log reads as finished right up to the failure.

Only reachable now that #332 got the build past the layer assertion — the third
latent fault in this install path, each one having masked the next: patch drift
(#328), enableWsi defaulting off (#332), and now this.

Nix seals $out read-only after the builder exits, so widening it mid-build costs
nothing and changes nothing in the output.
enricobuehler merged commit 1f0b12de6d into main 2026-08-19 14:42:33 +00:00
enricobuehler deleted branch gamescope-prune-writable 2026-08-19 14:42:43 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unom/punktfunk#336