NixOS now idles at 96MB of RAM and rebuilds inside 512MB

Shrinking NixOS RAM footprint and resource requirements to the bare minimum

A NixOS 26.05 template that once needed 1024MB of RAM and burned 288MB at idle now sits at 96MB with 54 kernel modules loaded. The author walks through the tweaks: disabling transparent huge pages, blacklisting hardware a KVM guest never has, trimming the kernel module tree from 162MB to 45MB, swapping systemd-timesyncd for a one-shot busybox ntpd, and tuning zram plus the Boehm GC so a full rebuild peaks at 371MB without an OOM kill.

I initially set aside half a day for this; it actually took closer to 3 days.
  1. KingMachiavelli

    I really wish building minimal, custom kernels was easier. NixOS makes it somewhat sane but it's still a mess of custom kconfig, defconfig target hacking, and manually splicing out the necessary firmware and kernel modules. The kernel doesn't even have an interface to show what firmware blobs have been loaded. You can do some firmware signature enforcement but I guess no one cares about random binary blobs are running just to work your laptop webcam.

    It would be very useful if I could just boot a kernel and get an instant report of what kernel config, firmware and modules are actually used/needed. You can kind of do this but

  2. wrxd

    Tangential but TierHive looks to be doing great work. You can get a VPS from them for about a couple of dollars a year.

    It's not going to be powerful (128MB of RAM 1GB of storage) but if you run Alpine or NetBSD you can use it as a WireGuard peer, to host a small

    Website or to run some cron jobs.

  3. yjftsjthsd-h

    > Blacklisted the hardware a KVM guest never has or doesn't need

    I'm a little surprised that matters; shouldn't Linux be lazy loading drivers only when it sees hardware?

More from this day

2026-11-03