Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ let
# systems, while -P 4 is ~30% slower. Cap at 8 but use fewer workers if the
# system has fewer cores.
mkdir -p "$rootMountPoint"/nix/store
# Limit dirty page accumulation to prevent OOM in the VM.
# The kernel evicts clean page cache under memory pressure, but dirty
# pages must be written back first. Low thresholds force early writeback
# so dirty pages never pile up enough to trigger the OOM killer,
# even when copying files larger than available RAM.
echo 10000000 > /proc/sys/vm/dirty_bytes
echo 5000000 > /proc/sys/vm/dirty_background_bytes
${
if cfg.copyNixStoreThreads == "auto" then
''
Expand Down
Loading