How minimal can a NixOS image get?

What’s the smallest NixOS image you’re able to build?

It seems the Minimal ISO Image on the Downloads page is around 1GB today.

How much further can this be trimmed to expose a minimal headless setup with SSH?

2 Likes

You can likely get down to 200-400MB quite easily. The minimal ISO is designed to work on as much hardware as possible so it includes the full linux-firmware package which is ~500MB of already compressed firmware so the compressed ISO is likely 50% firmware.

You’ll also want to disable docs and man pages. Trim the default system packages to just those strictly required.

You can use a tool like nix-tree to what’s contributing to a Nix closure size. Use the nix repl to view what’s adding packages to environment.systemPackages e.g on a flake check nixosConfigurations.myNixosConfig.options.environment.systemPackages.definitionsWithLocations.

4 Likes

Maybe get inspiration from:

4 Likes