Skip to content

Commit 7d7ca4c

Browse files
committed
chore(linux-builder): update memory
1 parent c419df4 commit 7d7ca4c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

nix/modules/darwin/linux-builder.nix

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,38 @@ in
5454
"flakes"
5555
"nix-command"
5656
];
57+
58+
# Swap: zram (primary) + swapfile (fallback) for memory-intensive builds
59+
zramSwap = {
60+
enable = true;
61+
memoryPercent = 50; # 4GB zram (~12GB effective with compression)
62+
algorithm = "zstd";
63+
priority = 100;
64+
};
65+
swapDevices = [
66+
{
67+
device = "/var/lib/swapfile";
68+
size = 4 * 1024; # 4GB fallback
69+
priority = 10;
70+
}
71+
];
72+
boot.kernel.sysctl."vm.swappiness" = 100;
73+
74+
# Increase file descriptor limits for large builds
75+
security.pam.loginLimits = [
76+
{
77+
domain = "*";
78+
type = "soft";
79+
item = "nofile";
80+
value = "524288";
81+
}
82+
{
83+
domain = "*";
84+
type = "hard";
85+
item = "nofile";
86+
value = "524288";
87+
}
88+
];
5789
};
5890
};
5991
}

0 commit comments

Comments
 (0)