mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[General] use zram instead of zswap
This commit is contained in:
parent
5578d0595f
commit
c9ded32d12
1 changed files with 16 additions and 1 deletions
17
general.nix
17
general.nix
|
|
@ -3,6 +3,8 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.general;
|
cfg = config.aviallon.general;
|
||||||
desktopCfg = config.aviallon.desktop;
|
desktopCfg = config.aviallon.desktop;
|
||||||
|
cmdline = config.aviallon.boot.cmdline;
|
||||||
|
zswapEnabled = if cmdline ? "zswap.enabled" then cmdline."zswap.enabled" == "Y" else false
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -117,12 +119,25 @@ in
|
||||||
|
|
||||||
aviallon.boot.cmdline = mkIf cfg.unsafeOptimizations {
|
aviallon.boot.cmdline = mkIf cfg.unsafeOptimizations {
|
||||||
mitigations = "off";
|
mitigations = "off";
|
||||||
"zswap.enabled" = "Y";
|
#"zswap.enabled" = "Y";
|
||||||
"zswap.shrinker_enabled" = "Y";
|
"zswap.shrinker_enabled" = "Y";
|
||||||
"zswap.compressor" = "zstd";
|
"zswap.compressor" = "zstd";
|
||||||
"zswap.pool" = "zsmalloc";
|
"zswap.pool" = "zsmalloc";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = zswapEnabled -> (!config.zramSwap.enable);
|
||||||
|
message = "If using zswap, you should disable zram, as both conflict with each other";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
zramSwap = {
|
||||||
|
enable = !zswapEnabled;
|
||||||
|
priority = 1000;
|
||||||
|
memoryPercent = 50;
|
||||||
|
};
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = mkDefault "schedutil";
|
powerManagement.cpuFreqGovernor = mkDefault "schedutil";
|
||||||
|
|
||||||
environment.noXlibs = mkIf (cfg.minimal && (!desktopCfg.enable)) true;
|
environment.noXlibs = mkIf (cfg.minimal && (!desktopCfg.enable)) true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue