diff options
author | amesgen <amesgen@amesgen.de> | 2023-10-07 11:34:20 +0200 |
---|---|---|
committer | amesgen <amesgen@amesgen.de> | 2023-10-07 16:27:57 +0200 |
commit | bbf7f58b578ecd171f554142330ea99a3f93fad1 (patch) | |
tree | e9880043c0a67732e2b2a75dfc7b4321a87d32ac | |
parent | 34d8d08fdd2bfa089dc670a6f3e5f0d645370925 (diff) |
nixos/borgbackup: add package option
Co-authored-by: Lin Jian <me@linj.tech>
-rw-r--r-- | nixos/modules/services/backup/borgbackup.nix | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nixos/modules/services/backup/borgbackup.nix b/nixos/modules/services/backup/borgbackup.nix index 3b44f097ab791..28887f8e2ad56 100644 --- a/nixos/modules/services/backup/borgbackup.nix +++ b/nixos/modules/services/backup/borgbackup.nix @@ -84,8 +84,8 @@ let backupScript = mkBackupScript backupJobName cfg; in nameValuePair backupJobName { description = "BorgBackup job ${name}"; - path = with pkgs; [ - borgbackup openssh + path = [ + config.services.borgbackup.package pkgs.openssh ]; script = "exec " + optionalString cfg.inhibitsSleep ''\ ${pkgs.systemd}/bin/systemd-inhibit \ @@ -137,7 +137,7 @@ let ''); mkBorgWrapper = name: cfg: mkWrapperDrv { - original = "${pkgs.borgbackup}/bin/borg"; + original = getExe config.services.borgbackup.package; name = "borg-job-${name}"; set = { BORG_REPO = cfg.repo; } // (mkPassEnv cfg) // cfg.environment; }; @@ -231,6 +231,8 @@ in { ###### interface + options.services.borgbackup.package = mkPackageOptionMD pkgs "borgbackup" { }; + options.services.borgbackup.jobs = mkOption { description = lib.mdDoc '' Deduplicating backups using BorgBackup. @@ -769,6 +771,7 @@ in { users = mkMerge (mapAttrsToList mkUsersConfig repos); - environment.systemPackages = with pkgs; [ borgbackup ] ++ (mapAttrsToList mkBorgWrapper jobs); + environment.systemPackages = + [ config.services.borgbackup.package ] ++ (mapAttrsToList mkBorgWrapper jobs); }); } |