linux: multiple outputs for kernel targets#324419
linux: multiple outputs for kernel targets#324419fpletz wants to merge 1 commit intoNixOS:stagingfrom
Conversation
This adds outputs for all built kernel targets and provides symlinks to all built images in the default output for compatibility. This way we can get rid of `lib.platforms.*.linux-kernel.target` eventually and we don't have to build the kernel multiple times for every target.
| ; | ||
|
|
||
| in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // { | ||
| in (optionalAttrs isModular { outputs = [ "out" "dev" ] ++ (lib.attrValues targetsToOutput); }) // { |
There was a problem hiding this comment.
We would end up wanting to have outputs even if the kernel wasn't built with module support.
|
Overall really like the concept! Would be very nice to be able to easily switch between different kernel image types without incurring the cost of a rebuild. I think using derivation outputs as the differentiator between different image types seems like the right way to go here. I think we will also need to modify https://github.com/nixos/nixpkgs/blob/d5e0de612a503ff9c1a3fe2d0853c0fbbe336fbd/nixos/modules/system/activation/top-level.nix#L104 to take account for this as well. This also probably makes that option ( |
| ["Image" "vmlinuz.efi"] | ||
| else | ||
| [stdenv.hostPlatform.linux-kernel.target] | ||
| , installTargets ? lib.unique (map (target: defaultMapKernelToInstallTargets.${target} or "install") kernelTargets) |
There was a problem hiding this comment.
I'm not sure how valuable it is to have a separate argument for installTargets, as I can't imagine a scenario where the kernelTargets passed wouldn't be directly correlated to installTargets. My understanding is the linux makefiles accept the kernel image targets as make targets already (e.g. make bzImage works directly, so something like make Image vmlinuz.efi should work as well)
Description of changes
Preview of an alternative idea for #244706 and inspired by #287122. Needs #239721.
This adds outputs for all built kernel targets and provides symlinks to all built images in the default output for compatibility. This way we can get rid of
lib.platforms.*.linux-kernel.targeteventually and we don't have to build the kernel multiple times for every target.Looking for feedback. Is this maybe a way to go?
TODO
lib.platforms.*.linux-kernelThings done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.