feat(restic): limit resource usage

This commit is contained in:
Felix Schröter 2022-05-11 19:02:41 +02:00
parent 436ba2719f
commit b57b2293ca
Signed by: felschr
GPG key ID: 671E39E6744C807D
2 changed files with 21 additions and 0 deletions

19
modules/restic.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
systemd.services = mapAttrs' (name: backup:
nameValuePair "restic-backups-${name}" ({
serviceConfig = {
CPUWeight = 25;
MemoryHigh = "50%";
MemoryMax = "75%";
IOWeight = 50;
IOSchedulingClass = "idle";
IOSchedulingPriority = 7;
};
})) config.services.restic.backups;
};
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ../../modules/restic.nix ];
age.secrets.restic-b2.file = ../../secrets/restic/b2.age; age.secrets.restic-b2.file = ../../secrets/restic/b2.age;
age.secrets.restic-password.file = ../../secrets/restic/password.age; age.secrets.restic-password.file = ../../secrets/restic/password.age;
} }