NixOS on raspberry pi zero w

You’re fortunate: I’ve just finished building an installer image of 23.11 for the Raspberry Pi B rev 2 (armv6-linux). Pretty much everything still works out-of-the-box (because of various efforts last year).

As you’ve figured already, there a couple of minor issues. The main one being compiler-rt that has accumulated a few regressions on ARM. Versions up to 14 have been patched in nixpkgs, version 15+ have a partial fix and haven’t been patched but effectively still don’t build. You can simply set llvmPackages = super.llvmPackages_14 to work around it.

Then, I’ve noticed a link problem in cmake, I haven’t figured out the root cause but you can fix it with cmake = super.cmake.overrideAttrs (old: { env.NIX_CFLAGS_COMPILE = "-latomic"; });.

That’s pretty much it if you’re building a headless system.

Oh, instead of patching that function to ignore missing modules, do this:

  # only add strictly necessary modules
  boot.initrd.includeDefaultModules = false;
  boot.initrd.kernelModules = [ "ext4" "mmc_block" ];
  disabledModules =
    [ "${modulesPath}/profiles/all-hardware.nix"
      "${modulesPath}/profiles/base.nix"
    ];

That’s because by default the NixOS installer tries to load a whole lot of garbage.

2 Likes