feat: add boot.kernel.sysctl and boot.kernelModules#384
Conversation
e0412d6 to
86089ea
Compare
jfroche
left a comment
There was a problem hiding this comment.
Thanks for these new options. If you manage to use the upstream docker module based on this, do not hesitate to upstream the required changes to related module or just a test that validates that the module works well.
| { | ||
| boot = lib.mkOption { | ||
| type = lib.types.raw; | ||
| boot = { |
There was a problem hiding this comment.
The problems is that we now implement a subset of the boot options. It doesn't cost us a lot more to stub more of boot options here. Maybe we should just copying the options defined in https://github.com/NixOS/nixpkgs/blob/80bdc1e5ce51f56b19791b52b2901187931f5353/nixos/modules/system/boot/kernel.nix) ? I guess importing that upstream file directly would have been a problem ?
There was a problem hiding this comment.
Yeah, I think importing it directly wouldn't give us much benefit anyway as a lot of those options don't really make sense in our context, and we'd still need to define extra stubs to make everything work properly.
There was a problem hiding this comment.
Thank you for adding that feature ! Could you add an extra container test for that ?
There was a problem hiding this comment.
Yes, for sure. I've pushed a commit that adds an extra test.
That said, to merge this, we might also need to update the documentation. Previously, the docs stated that we define boot with type raw. I'm not sure exactly how it should be rephrased now, so I'll leave that to you if that's alright.
|
I made a few changes and added a VM test to really test the sysctl/module feature. We still have a failing test when trying to check if the module configuration has been applied. Haven't figure it out yet |
Thanks! It is indeed a bit weird. I've added two debug prints to the VM test and found that the |
Wrap the systemd-modules-load drop-in in mkIf so it is only created when boot.kernelModules is non-empty.
Wrap the systemd-sysctl drop-in in mkIf to avoid referencing sysctl.d/60-nixos.conf when it does not exist.
Canonicalizing relative symlinks in systemd dependency directories (.wants, .requires) could resolve to incorrect paths if the target unit comes from the host system. Read the symlink target directly to preserve the intended relative path.
Introduce a dedicated module for managing kernel sysctl parameters. This module provides the `boot.kernel.sysctl` option to configure runtime kernel parameters. It also moves the `systemd-sysctl` service definition into this module, making it conditional on the `sysctl` option being used. Special merging logic is included for `net.core.rmem_max` and `net.core.wmem_max` to ensure the highest value is applied.
09ba3ef to
e8e80c0
Compare
Session variables now append to existing values using shell expansion
(`${VAR:+:$VAR}`) instead of overwriting them. This ensures that pre-existing
values (e.g., from a host environment) are preserved, aligning with common
expectations for variables like `PATH` or `XDG_DATA_DIRS`.
New tests verify this append behavior and confirm that regular
`environment.variables` still overwrite.
Implement #382 and make
bootmore extensible. To maintain backward compatibility and ensure the tests pass,boot.kernelPackages.kernel.versionis also stubbed. Some potential side effects are: if users import other modules that access additionalbootattributes downstream and those are not stubbed in this PR, they will need to provide stub values underbootthemselves.