diff --git a/modules/restic.nix b/modules/restic.nix new file mode 100644 index 0000000..2c5dbad --- /dev/null +++ b/modules/restic.nix @@ -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; + }; +} diff --git a/services/restic/common.nix b/services/restic/common.nix index 04fa699..edf187d 100644 --- a/services/restic/common.nix +++ b/services/restic/common.nix @@ -1,6 +1,8 @@ { config, pkgs, lib, ... }: { + imports = [ ../../modules/restic.nix ]; + age.secrets.restic-b2.file = ../../secrets/restic/b2.age; age.secrets.restic-password.file = ../../secrets/restic/password.age; }