nixos/gitea: add 'backupDir' option

This commit is contained in:
Izorkin 2020-07-31 00:04:23 +03:00
parent f77e28d83d
commit 4e68da6337

View File

@ -162,6 +162,12 @@ in
<manvolnum>7</manvolnum></citerefentry>. <manvolnum>7</manvolnum></citerefentry>.
''; '';
}; };
backupDir = mkOption {
type = types.str;
default = "${cfg.stateDir}/dump";
description = "Path to the dump files.";
};
}; };
appName = mkOption { appName = mkOption {
@ -357,6 +363,9 @@ in
}; };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d '${cfg.dump.backupDir}' 0750 ${cfg.user} gitea - -"
"z '${cfg.dump.backupDir}' 0750 ${cfg.user} gitea - -"
"Z '${cfg.dump.backupDir}' - ${cfg.user} gitea - -"
"d '${cfg.repositoryRoot}' 0750 ${cfg.user} gitea - -" "d '${cfg.repositoryRoot}' 0750 ${cfg.user} gitea - -"
"z '${cfg.repositoryRoot}' 0750 ${cfg.user} gitea - -" "z '${cfg.repositoryRoot}' 0750 ${cfg.user} gitea - -"
"Z '${cfg.repositoryRoot}' - ${cfg.user} gitea - -" "Z '${cfg.repositoryRoot}' - ${cfg.user} gitea - -"
@ -448,7 +457,7 @@ in
ProtectKernelTunables = true; ProtectKernelTunables = true;
ProtectKernelModules = true; ProtectKernelModules = true;
ProtectControlGroups = true; ProtectControlGroups = true;
ReadWritePaths = [ cfg.repositoryRoot cfg.stateDir ]; ReadWritePaths = [ cfg.dump.backupDir cfg.repositoryRoot cfg.stateDir ];
UMask = "0027"; UMask = "0027";
# Caps # Caps
CapabilityBoundingSet = ""; CapabilityBoundingSet = "";
@ -513,7 +522,7 @@ in
Type = "oneshot"; Type = "oneshot";
User = cfg.user; User = cfg.user;
ExecStart = "${gitea}/bin/gitea dump"; ExecStart = "${gitea}/bin/gitea dump";
WorkingDirectory = cfg.stateDir; WorkingDirectory = cfg.dump.backupDir;
}; };
}; };