Skip to content

systemd: use mkDefault for oomd.enable to allow downstream override#1028

Merged
SuperSandro2000 merged 2 commits intonix-community:mainfrom
timblaktu:fix/oomd-psi-available
Apr 15, 2026
Merged

systemd: use mkDefault for oomd.enable to allow downstream override#1028
SuperSandro2000 merged 2 commits intonix-community:mainfrom
timblaktu:fix/oomd-psi-available

Conversation

@timblaktu
Copy link
Copy Markdown
Contributor

Summary

  • Change bare false to lib.mkDefault false for systemd.oomd.enable
  • Modern WSL2 kernels (6.1+) support PSI (/proc/pressure/*), making systemd-oomd functional
  • Default behavior unchanged — oomd remains disabled unless downstream explicitly enables it

Motivation

Downstream NixOS-WSL consumers using cgroup-based memory limits (e.g., for nix evaluation guards) need systemd-oomd for ManagedOOMMemoryPressure=kill on custom slices. Currently this requires mkForce to override the bare false, which is unnecessarily heavy.

Testing

Verified on WSL2 kernel 6.6.87.2-microsoft-standard-WSL2:

  • /proc/pressure/memory returns valid PSI data
  • systemd-oomd.service starts and runs correctly after override
  • ManagedOOMMemoryPressure=kill on custom slices works as expected

systemd-oomd was unconditionally disabled with a bare `false` because
older WSL2 kernels lacked CONFIG_PSI (Pressure Stall Information).
Modern WSL2 kernels (6.1+, including the current 6.6.x series) support
PSI via /proc/pressure/*, making systemd-oomd functional.

Change from bare `false` to `lib.mkDefault false` so downstream NixOS-WSL
consumers on modern kernels can re-enable oomd with a simple
`systemd.oomd.enable = true` (or mkDefault true) without needing mkForce.

The default behavior is unchanged — oomd remains disabled unless
explicitly enabled by the consumer.
Comment thread modules/systemd/default.nix Outdated
@SuperSandro2000 SuperSandro2000 merged commit 9a8c2a8 into nix-community:main Apr 15, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants