The Pi 3 profile didn't import ../common/default.nix, so it skipped
the shared boot.initrd.availableKernelModules (usb-storage, usbhid,
vc4). Every other board profile imports common/. Bring Pi 3 in line.
PR #1788 added hardware.raspberry-pi.configtxt and a defaults file,
but nothing imported them, so the options had no effect. Import both
from common/default.nix. Board profiles that already import common/
(2, 4, 5) now apply the pi-gen-equivalent defaults.
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before #1841.
Fixes#1859.
Override the nixpkgs common-config.nix values that conflict with the RPi
vendor defconfigs. Without these the kernel config silently differs from
the vendor defconfig.
mkForce is used only on options where nixpkgs common-config sets a
conflicting value at normal priority.
Ref: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs
Set CONFIG_LOCALVERSION via structuredExtraConfig instead of patching
.config and auto.conf with sed after configure. The vendor defconfigs
set -v7, -v8, -v8-16k which breaks modDirVersion.
As mentioned in Nixpkgs PR [^1], Raspberry Pi folks stop tagging both
raspberrypi/linux and raspberrypi/firmware GitHub repo. So, I switched
my reference point to Raspberry Pi OS, which publishes their packaging
for Linux kernel in RPi-Distro/linux-packaging.
The version is set to Debian packaging's version, and the commit comes
from the changelog entry for that version.
The old code structure is somewhat kept in case Raspberry Pi ever tags
their raspberrypi/linux repo again.
[^1]: https://github.com/NixOS/nixpkgs/pull/493115
- Gate on rpiVersion instead of architecture; skip for Pi 4+ where
vendor and upstream DTB names already match
- Fix bcm2835-rpi-zero.dtb: was copied from bcm2708-rpi-b-plus (wrong
board), now uses bcm2708-rpi-zero
- Drop bcm2711-rpi-4-b -> bcm2838-rpi-4-b copy; nothing uses bcm2838-*
Ref: https://github.com/u-boot/u-boot/blob/master/board/raspberrypi/rpi/rpi.c
lib.overrideDerivation is deprecated and strips passthru attributes
(.configfile, .moduleBuildDependencies, etc.) from the kernel
derivation, which breaks downstream users expecting a standard
buildLinux output.
.overrideAttrs preserves passthru and matches every other custom
kernel in this repo.
This allows the generic ubootRaspberryPiAarch64 package from nixpkgs to
be used with Raspberry Pi 5.
Signed-off-by: Filip Kokosiński <filip.kokosinski@gmail.com>
null was not in the settings type, so mkForce null to remove a default
was a type error. Added nullOr to atom and filter nulls in recurse.
Changed file from types.str to types.path with pkgs.writeText — this
is how services.mysql.configFile and similar options work. Moved the
generated file into the option default (with defaultText) rather than
setting it in the config block.
Two new files in raspberry-pi/common/:
config-txt.nix lets you declare config.txt contents through
hardware.raspberry-pi.configtxt.settings (RFC 42 style — plain
values, null to remove, no enable/value wrappers).
config-txt-defaults.nix has the same defaults as Raspberry Pi OS:
vc4-kms-v3d, audio on, arm_boost, CM4 otg_mode, CM5 dwc2, etc.
All mkDefault so they are easy to override.
Not wired into board profiles yet — that comes with the RPi 5
sub-module work. Based on nvmd/nixos-raspberrypi.