Created
October 7, 2025 17:39
-
-
Save astr0n8t/8643b4695084c56be7c523a421f0a6a9 to your computer and use it in GitHub Desktop.
Working format to get a working Raspberry Pi 2B+ SD card build using NixOS and nixos-generators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| system = "armv7l-linux"; | |
| format = "sd-armv7l"; | |
| customFormats = { "sd-armv7l" = ./formats/sd-armv7l.nix; }; | |
| modules = [ | |
| nixos-hardware.nixosModules.raspberry-pi-2 | |
| ]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| config, | |
| lib, | |
| pkgs, | |
| modulesPath, | |
| ... | |
| }: { | |
| imports = [ | |
| "${toString modulesPath}/installer/sd-card/sd-image-armv7l-multiplatform.nix" | |
| ]; | |
| boot.initrd.includeDefaultModules = false; | |
| boot.initrd.kernelModules = [ "ext4" "mmc_block" ]; | |
| boot.supportedFilesystems = lib.mkForce [ "vfat" "ext4" ]; | |
| disabledModules = | |
| [ "${modulesPath}/profiles/all-hardware.nix" | |
| "${modulesPath}/profiles/base.nix" | |
| ]; | |
| sdImage = { | |
| populateFirmwareCommands = | |
| '' | |
| (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp *rpi-2*.dtb $NIX_BUILD_TOP/firmware/) | |
| ''; | |
| }; | |
| formatAttr = "sdImage"; | |
| fileExtension = ".img.*"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment