Skip to content

raspberry-pi: add config.txt generation module#1788

Open
JamieMagee wants to merge 2 commits intoNixOS:masterfrom
JamieMagee:raspberry-pi-config-txt
Open

raspberry-pi: add config.txt generation module#1788
JamieMagee wants to merge 2 commits intoNixOS:masterfrom
JamieMagee:raspberry-pi-config-txt

Conversation

@JamieMagee
Copy link
Member

Two new files in raspberry-pi/common/ for generating Raspberry Pi config.txt from Nix.

config-txt.nix adds hardware.raspberry-pi.configtxt.settings, which covers options, dtparam, dtoverlay, and conditional filters ([pi5], [cm4], etc.).

config-txt-defaults.nix ships the standard Raspberry Pi OS defaults1, all mkDefault.

Not exposed in flake.nix. These are internal, meant to be imported by board profiles once the RPi 5 sub-module work follows. Doesn't write to /boot/firmware/ yet, that needs the bootloader module.

Context: porting config.txt infrastructure from nvmd/nixos-raspberrypi (see nvmd/nixos-raspberrypi#78).

Footnotes

  1. https://github.com/RPi-Distro/pi-gen/blob/master/stage1/00-boot-files/files/config.txt

@JamieMagee
Copy link
Member Author

@quentinmit Thanks for the review! I pushed a rework that covers everything you raised.

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.
@JamieMagee JamieMagee force-pushed the raspberry-pi-config-txt branch from 2b1b66b to a688dfc Compare March 9, 2026 06:18
@JamieMagee JamieMagee requested a review from quentinmit March 9, 2026 17:48
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.
@JamieMagee JamieMagee force-pushed the raspberry-pi-config-txt branch from 8fbb4ed to b4766ff Compare March 10, 2026 04:22
@JamieMagee JamieMagee requested a review from quentinmit March 11, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants