OOM-safety (zram / build-concurrency caps / nix-daemon cgroup) not shipped to adopters #5

Open
opened 2026-06-29 03:03:09 +00:00 by padreug · 0 comments
Owner

Problem

The protections that keep a big nixos-rebuild from OOM-killing the desktop live only in the maintainer's private configuration.nix, which adopters don't import:

  • zramSwap (compressed in-RAM swap — release valve when a build spikes)
  • bounded nix.settings.max-jobs / cores
  • systemd.services.nix-daemon.serviceConfig MemoryHigh / MemoryMax cgroup caps

So an adopter on a modest-RAM machine with no disk swap hits the kernel OOM-killer mid-rebuild (observed: Brave reaped during a build on a 16GB laptop; the kernel had no swap release valve).

Impact

Medium — degrades the install experience on common hardware (laptops, low-RAM boxes), exactly the audience for a turnkey desktop.

Suggested fix

Move sane defaults into a core module (modules/cache.nix already owns nix.settings). At minimum a zramSwap release valve enabled by mkDefault, plus conservative max-jobs/cores. Optionally a nix-daemon memory cgroup. Use mkDefault so beefy hosts can override.

Found while helping a friend adopt the template on existing NixOS.

## Problem The protections that keep a big `nixos-rebuild` from OOM-killing the desktop live **only in the maintainer's private `configuration.nix`**, which adopters don't import: - `zramSwap` (compressed in-RAM swap — release valve when a build spikes) - bounded `nix.settings.max-jobs` / `cores` - `systemd.services.nix-daemon.serviceConfig` `MemoryHigh` / `MemoryMax` cgroup caps So an adopter on a modest-RAM machine with **no disk swap** hits the kernel OOM-killer mid-rebuild (observed: Brave reaped during a build on a 16GB laptop; the kernel had no swap release valve). ## Impact Medium — degrades the install experience on common hardware (laptops, low-RAM boxes), exactly the audience for a turnkey desktop. ## Suggested fix Move sane defaults into a core module (`modules/cache.nix` already owns `nix.settings`). At minimum a `zramSwap` release valve enabled by `mkDefault`, plus conservative `max-jobs`/`cores`. Optionally a `nix-daemon` memory cgroup. Use `mkDefault` so beefy hosts can override. Found while helping a friend adopt the template on existing NixOS.
Sign in to join this conversation.
No labels
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
aiolabs/omnixient#5
No description provided.