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/swap: add discardPolicy option #107728
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
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.
LGTM!
Edit: I'm not sure whether it makes sense to add a test for this, otherwise this corresponds to the parameter description given in the swapon(8)
man page.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Tested by building the following derivation manually under different swap options: Don't know if this suffices |
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.
LGTM.
The change is backward compatible.
There are one more possible option for swap devices in fstab (at least on my current system) : nofail
. That could be added later if it's needed. They are not too many options so listing them explicitly (rather than using something like extraOptions
) is fine.
@ThibautMarty I think I applied all your suggestions, retested and everything works. Thank you very much |
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.
Last nitpicking and we it's good for me.
Add option for activating discards on swap partitions (none, once, pages and both).
@ThibautMarty maybe this time I didn't forget anything |
🎉 |
Add option for activating discards on swap partitions (none, once, pages and both).
Motivation for this change
Especially when hibernating, many gigs get written to disk. I would have liked to see the possibility of specifying a discard policy in NixOS.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)