nixos/zswap: init module
Add zswap support for NixOS!
Things done
- Built on platform:
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- Tested, as applicable:
- [ ] NixOS tests in nixos/tests.
- [ ] Package tests at
passthru.tests. - [ ] Tests in lib/tests or pkgs/test for functions and "core" functionality.
- [ ] Ran
nixpkgs-reviewon this PR. See nixpkgs-review usage. - [ ] Tested basic functionality of all binary files, usually in
./result/bin/. - Nixpkgs Release Notes
- [ ] Package update: when the change is major or breaking.
- NixOS Release Notes
- [x] Module addition: when adding a new NixOS module.
- [ ] Module update: when the change is significant.
- [ ] Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.
Add a :+1: reaction to pull requests you find important.
Maybe more flexible via sysfs interface? E.g.
https://github.com/merrkry/decalratia/blob/03a35e1330d62e3765aa02e51af64ec6b5af3e81/modules/nixos/zswap.nix#L67-L78
Edit: since we have now boot.kernel.sysfs, it is more preferred.
Maybe more flexible via sysfs interface? E.g.
https://github.com/merrkry/decalratia/blob/03a35e1330d62e3765aa02e51af64ec6b5af3e81/modules/nixos/zswap.nix#L67-L78
Edit: since we have now
boot.kernel.sysfs, it is more preferred.
Good suggestion. I will add a activationScripts (use sysfs) to support runtime switch.
Seems like the main functional benefits of this is making sure the correct compressor is initialized and a more user friendly, less error prone module interface even if it is essentially a wrapper around the sysfs module.
@luochen1990 if you want some inspiration for writing tests for this module, you can look at my defunct pr for adding zswap prior to deciding to create a sysfs module: https://github.com/NixOS/nixpkgs/pull/401335/files#diff-63fa3c8534f428c4303388194910376a071ff01ed7be6f2c057ae83f2f50f3f8