zfsborg: remove the ${mountpoint}/.snapshot-latest prefix

The path in the filesystem is quite clear from the archive name.
This commit is contained in:
2023-09-15 11:04:20 +03:00
parent 331ffa9450
commit 7ee6a0de71
2 changed files with 35 additions and 30 deletions

View File

@@ -4,9 +4,14 @@
pkgs,
...
}: let
mountLatest = mountpoint: zfs_name: ''
mkPreHook = mountpoint: zfs_name: ''
set -x
exec ${pkgs.util-linux}/bin/mount -t zfs -o ro $(${pkgs.zfs}/bin/zfs list -H -t snapshot -o name ${zfs_name} | sort | tail -1) ${mountpoint}/.snapshot-latest
${pkgs.util-linux}/bin/mount \
-t zfs \
-o ro \
$(${pkgs.zfs}/bin/zfs list -H -t snapshot -o name ${zfs_name} | sort | tail -1) \
${mountpoint}/.snapshot-latest
cd ${mountpoint}/.snapshot-latest
'';
in {
options.mj.base.zfsborg = with lib.types; {
@@ -25,7 +30,7 @@ in {
options = {
mountpoint = lib.mkOption {type = path;};
repo = lib.mkOption {type = str;};
paths = lib.mkOption {type = listOf path;};
paths = lib.mkOption {type = listOf str;};
patterns = lib.mkOption {
type = listOf str;
default = [];
@@ -87,7 +92,7 @@ in {
extraArgs = "--remote-path=borg1";
compression = "auto,lzma";
startAt = attrs.backup_at;
preHook = mountLatest mountpoint fs.device;
preHook = mkPreHook mountpoint fs.device;
prune.keep = {
within = "1d";
daily = 7;