From cc38f3aa65faafbc348ca9fb3ee3e831f640c430 Mon Sep 17 00:00:00 2001 From: clerie Date: Sat, 10 Apr 2021 14:59:32 +0200 Subject: [PATCH] Allow specifying umask for borgbackup repos --- modules/borgbackup/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/borgbackup/default.nix b/modules/borgbackup/default.nix index db1edb3..d67167c 100644 --- a/modules/borgbackup/default.nix +++ b/modules/borgbackup/default.nix @@ -156,10 +156,11 @@ let let # Because of the following line, clients do not need to specify an absolute repo path cdCommand = "cd ${escapeShellArg cfg.path}"; + umaskArg = optionalString (cfg.umask != null) "--umask ${cfg.umask}"; restrictedArg = "--restrict-to-${if cfg.allowSubRepos then "path" else "repository"} ."; appendOnlyArg = optionalString appendOnly "--append-only"; quotaArg = optionalString (cfg.quota != null) "--storage-quota ${cfg.quota}"; - serveCommand = "borg serve ${restrictedArg} ${appendOnlyArg} ${quotaArg}"; + serveCommand = "borg ${umaskArg} serve ${restrictedArg} ${appendOnlyArg} ${quotaArg}"; in ''command="${cdCommand} && ${serveCommand}",restrict ${key}''; @@ -646,6 +647,15 @@ in { example = "100G"; }; + umask = mkOption { + type = with types; nullOr str; + description = '' + Permissions applied to newly created files and directories. + ''; + default = null; + example = "0027"; + }; + }; } ));