mirror of
https://github.com/ItsDrike/nixdots
synced 2024-11-10 04:59:42 +00:00
Limit journal size
This commit is contained in:
parent
0a9742429d
commit
7a17948e90
|
@ -5,5 +5,7 @@ _: {
|
||||||
./logrotate.nix
|
./logrotate.nix
|
||||||
./oomd.nix
|
./oomd.nix
|
||||||
./thermald.nix
|
./thermald.nix
|
||||||
|
./journald.nix
|
||||||
|
./fstrim.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
35
system/shared/services/fstrim.nix
Normal file
35
system/shared/services/fstrim.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, lib, ... }: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
in {
|
||||||
|
# if lvm is enabled, then tell it to issue discards
|
||||||
|
# (this is good for SSDs and has almost no downsides on HDDs, so
|
||||||
|
# it's a good idea to enable it unconditionally)
|
||||||
|
environment.etc."lvm/lvm.conf".text = mkIf config.services.lvm.enable ''
|
||||||
|
devices {
|
||||||
|
issue_discards = 1
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# discard blocks that are not in use by the filesystem, good for SSDs
|
||||||
|
services.fstrim = {
|
||||||
|
# we may enable this unconditionally across all systems becuase it's performance
|
||||||
|
# impact is negligible on systems without a SSD - which means it's a no-op with
|
||||||
|
# almost no downsides aside from the service firing once per week
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# the default value, good enough for average-load systems
|
||||||
|
interval = "weekly";
|
||||||
|
};
|
||||||
|
|
||||||
|
# tweak fstim service to run only when on AC power
|
||||||
|
# and to be nice to other processes
|
||||||
|
# (this is a good idea for any service that runs periodically)
|
||||||
|
systemd.services.fstrim = {
|
||||||
|
unitConfig.ConditionACPower = true;
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Nice = 19;
|
||||||
|
IOSchedulingClass = "idle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
9
system/shared/services/journald.nix
Normal file
9
system/shared/services/journald.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
# Limit systemd journal size, as the default is unlimited and
|
||||||
|
# journals get big really fast
|
||||||
|
services.journald.extraConfig = ''
|
||||||
|
SystemMaxUse=100M
|
||||||
|
RuntimeMaxUse=50M
|
||||||
|
SystemMaxFileSize=50M
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue