-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
nixos/config/sysfs: init module #391329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
nixos/config/sysfs: init module #391329
Conversation
09c76cf
to
c1a036b
Compare
The NixOS manual build failure appears to be unrelated to this change. I am able to build the manual locally without any issues: |
4919977
to
cd2a1b7
Compare
15061d8
to
8461f59
Compare
4f517c7
to
ebfe568
Compare
One issue here, is that a lot of sysfs paths depend on kernel modules being loaded, which may happen at a later time. I wonder if we'd want to support something like that? Currently the module in this PR will only work for sysfs paths that are present at the time systemd-tmpfiles runs. |
boot.kernel.sysfs = lib.mkOption { | ||
type = lib.types.submodule { | ||
freeformType = lib.types.attrsOf sysfsAttrs // { | ||
description = "nested attribute set of null or sysfs attribute values"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types have descriptions? That's new to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is usually generated automatically, but due to the nesting this would lead to an infinite recursion. I therefore override the description
attribute and describe the type manually.
This description is included in the generated option documentation.
sysctl has the same problem. I usually work around it by loading the kernel module already in the initrd. |
Instead of relying on |
add7c3f
to
b07085f
Compare
Continued in #392127, closing this one. |
This PR is about sysfs options, not sysctls. I could revert / reset to the original proposal which used a single tmpfiles configuration to set options on startup. |
I sadly cannot add much for review here but closing the PR looked like a mistake especially based on the comment above. |
I tested enabling |
Did you mean "zswap"? That's a great news! |
It also works well configuring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks interesting, would be nice to get this merged.
b07085f
to
1305aee
Compare
|
This module introduces a config option
boot.kernel.sysfs
, which permits setting of sysfs parameters.The configuration option accepts a nested attribute set of sysfs path components with arbitrary values, for example:
The options will be applied through systemd path units watching the individual files or glob patterns and writing the configured value through a small service using systemd-tmpfiles once they exist.
The supplied NixOS test checks if configured parameters are actually applied.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-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.