Description
Hello!
I hope this is the right place! I saw that the nix-community/raspberry-pi-nix/ was archived in favor of using the upstream nixos-hardware.
Though since I need to upgrade some Raspberry Pi 5, I started making new images, trying to figure it out by myself as there is no easy-to-use docs/guide yet... so I said to myself that maybe I could write something!
I followed the README files, but sadly I hit a bunch of issues.
The first issue is that when I try to build a SD Image, the stable/default kernel does not build, with this error:
error: builder for '/nix/store/r0i4a8w9fw2km28kb2hc7lgbcsw1i895-linux-rpi-6.6.31-stable_20240529-modules-shrunk.drv' failed with exit code 1;
last 25 log lines:
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio_ring.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/block/virtio_blk.ko.xz
> root module: virtio_scsi
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio.ko.xz
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio_ring.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/scsi/virtio_scsi.ko.xz
> root module: virtio_balloon
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio.ko.xz
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio_ring.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio_balloon.ko.xz
> root module: virtio_console
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio.ko.xz
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/virtio/virtio_ring.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/char/virtio_console.ko.xz
> root module: mptspi
> dependency already copied: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/scsi/scsi_transport_spi.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/message/fusion/mptbase.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/message/fusion/mptscsih.ko.xz
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/message/fusion/mptspi.ko.xz
> root module: vmxnet3
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/drivers/net/vmxnet3/vmxnet3.ko.xz
> root module: vsock
> copying dependency: /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31/kernel/net/vmw_vsock/vsock.ko.xz
> root module: sun4i-drm
> modprobe: FATAL: Module sun4i-drm not found in directory /nix/store/65q31i6sc4qjcyz4xg1n5ijqaa612aln-linux-rpi-6.6.31-stable_20240529-modules/lib/modules/6.6.31
For full logs, run 'nix log /nix/store/r0i4a8w9fw2km28kb2hc7lgbcsw1i895-linux-rpi-6.6.31-stable_20240529-modules-shrunk.drv'.
error: 1 dependencies of derivation '/nix/store/bm8d5bgqg50wfjs49qjfci2n0n5p2rqq-initrd-linux-rpi-6.6.31-stable_20240529.drv' failed to build
error: 1 dependencies of derivation '/nix/store/akmpf21il4gla2c2vx14zd9wr8zhvj5b-nixos-system-naspi5-24.11.20250412.26d499f.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hwdqc93lrwx5189rd3wb9gcbghnwdzaq-ext4-fs.img.zst.drv' failed to build
error: 1 dependencies of derivation '/nix/store/34177gql4jpng89h05k0f7lllmxbkdln-nixos-sd-image-24.11.20250412.26d499f-aarch64-linux.img.drv' failed to build
error: 1 dependencies of derivation '/nix/store/alxw6cw93nfga1hc3k900mynvrck3xcv-nixos-sd-image-24.11.20250412.26d499f-aarch64-linux.img.drv' failed to build
So if I try, using Linux 6.12, and it works fine! It builds a SD image... though, the /boot
directory is missing the .dtb
files for the Raspberry Pi 5, and it does not boot at all:
Previously (with nix-community/raspberry-pi-nix) it was booting properly and I could customize the config.txt, though I just want to boot it for now. So, I tried to add the following line to force rpi5:
hardware.deviceTree.filter = lib.mkForce "*rpi-5*.dtb";
But the result is always the same, and /boot
is missing the Raspberry Pi 5 files. 😢 (or even *.dtb
has the same results).
Checking raspberrypifw
from nixpkgs stable (24.11, currently 1.20240926) is using a version that does include the raspberry pi 5 files (here).
Ofc I tried to manually match the kernel version and the dtb
files by copying them, but as I was expecting, that failed miserably.
My current goal is: Boot the Pi 5 but since the unexpected deprecation of nix-community/raspberry-pi-nix I am very lost. Like me, for context, up until now people managed to boot only using raspberry-pi-nix. See:
- Raspberry Pi 5 support nixpkgs#260754
- https://discourse.nixos.org/t/what-happened-to-raspberry-pi-nix/62417
How To Reproduce
Both with nixpks 24.11 and unstable, things are broken, but the archived nix-community/raspberry-pi-nix project works. This is how you can reproduce the issue.
In My flake: When removing the code from nix-community/raspberry-pi-nix, I replaced it with the nixos-hardware by setting the modules like this:
# [...]
pi5 = nixosSystem {
system = "aarch64-linux";
modules = [
nixos-generators.nixosModules.all-formats
nixos-hardware.nixosModules.raspberry-pi-5
];
};
Then I would use this to build it using nixos-generators:
nix build ".#nixosConfigurations.pi5.config.formats.sd-aarch64"