Skip to content

modules: add enable option guards#152

Open
JamieMagee wants to merge 1 commit into
nvmd:developfrom
JamieMagee:feat/module-enable-guards
Open

modules: add enable option guards#152
JamieMagee wants to merge 1 commit into
nvmd:developfrom
JamieMagee:feat/module-enable-guards

Conversation

@JamieMagee
Copy link
Copy Markdown
Contributor

Right now, importing any of these modules (bluetooth, display-vc4, display-rp1, usb-gadget-ethernet, pisugar-3, nice-looking-console) immediately activates their config. There's no way to import one just to inspect its options or conditionally disable it in a higher-level config.

The NixOS module convention is to gate side effects behind an enable option with mkIf, so that's what this does. Each module gets a hardware.raspberry-pi.<module>.enable option. They all default to true to avoid breaking anyone's existing setup.

@JamieMagee JamieMagee force-pushed the feat/module-enable-guards branch 2 times, most recently from 26999ef to fe70b33 Compare March 16, 2026 22:07
Add hardware.raspberry-pi.<module>.enable options (defaulting to true)
with mkIf guards to: bluetooth, display-vc4, display-rp1,
usb-gadget-ethernet, pisugar-3, and nice-looking-console.

This lets users import a module without unconditionally activating it,
while preserving backward compatibility for existing configurations.
@JamieMagee JamieMagee force-pushed the feat/module-enable-guards branch from fe70b33 to 43622ed Compare March 21, 2026 20:17
@DerRockWolf
Copy link
Copy Markdown

DerRockWolf commented Apr 7, 2026

Same issue with the default nixosModule or?

boot.loader.raspberry-pi = {
enable = true;
};

I noticed this when wanting to set boot.loader.raspberry-pi.bootloader with a mkIf in a module which I import for all my hosts (not just my Pis). The bootloader module can already be imported on it's own, but it depends on hardware.raspberry-pi

@doronbehar doronbehar mentioned this pull request Apr 30, 2026
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