nixos/vaultwarden: create backupDir using tmpfiles.d

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>

Changed files
+9 -2
nixos
modules
services
security
vaultwarden
+2 -2
nixos/modules/services/security/vaultwarden/backup.sh
···
#!/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
+7
nixos/modules/services/security/vaultwarden/default.nix
···
};
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