systemd: use mkDefault for oomd.enable to allow downstream override#1028
Merged
SuperSandro2000 merged 2 commits intonix-community:mainfrom Apr 15, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
falsetolib.mkDefault falseforsystemd.oomd.enable/proc/pressure/*), making systemd-oomd functionalMotivation
Downstream NixOS-WSL consumers using cgroup-based memory limits (e.g., for nix evaluation guards) need systemd-oomd for
ManagedOOMMemoryPressure=killon custom slices. Currently this requiresmkForceto override the barefalse, which is unnecessarily heavy.Testing
Verified on WSL2 kernel 6.6.87.2-microsoft-standard-WSL2:
/proc/pressure/memoryreturns valid PSI datasystemd-oomd.servicestarts and runs correctly after overrideManagedOOMMemoryPressure=killon custom slices works as expected