nixos-generate-config script adds
<nixpkgs/nixos/modules/installer/scan/not-detected.nix> to the imports list in
hardware-configuration.nix. That file (
not-detected.nix) seems to merely set the default for
hardware.enableRedistributableFirmware and according to its history, never did more than that.
Is there a reason for this strange extra indirection?
I.e. why not just write
hardware.enableRedistributableFirmware = lib.mkDefault true; directly into
hardware-configuration.nix as its done with the other options?
I’d guess it’s so that more things can be done for undetected systems in the future without regenerating hardware-configuration.nix. The rest of hardware-configuration.nix is literally specific to your hardware, and so would never be able to benefit from such a thing.
Ok, but that could also be achieved by setting an option which then toggles various things (instead of importing that path directly), I guess?
That’s fair. Just two ways of doing the same thing. I guess the current way could technically be a little faster, since it means systems that don’t use
not-detected.nix don’t have to load the file and load its options.
The current way does have the disadvantage of relying on NIX_PATH, which will not be available when flakes I guess?
No, but if you look at the nixpkgs flake, you can see that it exports
not-detected as a NixOS module, perhaps for future use in