Merge pull request #259849 from Scrumplex/nixos/vaultwarden/backupDirCreate
nixos/vaultwarden: create backupDir using tmpfiles.d
This commit is contained in:
commit
c360b49704
2 changed files with 10 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Based on: https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault
|
||||
if ! mkdir -p "$BACKUP_FOLDER"; then
|
||||
echo "Could not create backup folder '$BACKUP_FOLDER'" >&2
|
||||
if [ ! -d "$BACKUP_FOLDER" ]; then
|
||||
echo "Backup folder '$BACKUP_FOLDER' does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ in {
|
|||
description = lib.mdDoc ''
|
||||
The directory under which vaultwarden will backup its persistent data.
|
||||
'';
|
||||
example = "/var/backup/vaultwarden";
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
|
@ -230,6 +231,13 @@ in {
|
|||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.settings = mkIf (cfg.backupDir != null) {
|
||||
"10-vaultwarden".${cfg.backupDir}.d = {
|
||||
inherit user group;
|
||||
mode = "0770";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# uses attributes of the linked package
|
||||
|
|
Loading…
Reference in a new issue