-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
nixos/boot: add boot.tmp.useZram option #320917
base: master
Are you sure you want to change the base?
Conversation
a3982b8
to
1574518
Compare
example = "lzo-rle"; | ||
description = '' | ||
The compression algorithm to use for the zram device, | ||
or leave unspecified to keep the kernel default. |
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 default is actually specified by us (not the kernel) as zstd.
Co-authored-by: Arne Keller <[email protected]>
}; | ||
|
||
zramSettings = { | ||
zram-size = mkOption { |
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.
zram-size = mkOption { | |
zram-size = lib.mkOption { |
''; | ||
}; | ||
|
||
compression-algorithm = mkOption { |
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.
compression-algorithm = mkOption { | |
compression-algorithm = lib.mkOption { |
''; | ||
}; | ||
|
||
fs-type = mkOption { |
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.
fs-type = mkOption { | |
fs-type = lib.mkOption { |
''; | ||
}; | ||
|
||
options = mkOption { |
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.
options = mkOption { | |
options = lib.mkOption { |
|
||
zramSettings = { | ||
zram-size = mkOption { | ||
type = types.str; |
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.
type = types.str; | |
type = lib.types.str; |
Same for other types
Description of changes
This PR provides an alternative option for the
boot.tmp.useTmpfs
setting, allowing a zram device to be used directly as /tmp.In certain scenarios, this choice can be more effective than using zram as swap and waiting for tmpfs to trigger swap due to memory pressure. After all, the conditions for triggering swap are unrelated to the compression ratio of the content. In situations where it can be presupposed that the contents of the /tmp directory will have a higher compression ratio, the option provided by this PR will be an excellent solution.
Things done
Provide an option named
boot.tmp.useZram
, and related options namedboot.tmp.zramSettings.*
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.