zfsborg: remove the ${mountpoint}/.snapshot-latest prefix
The path in the filesystem is quite clear from the archive name.
This commit is contained in:
parent
331ffa9450
commit
7ee6a0de71
@ -63,15 +63,15 @@
|
|||||||
mountpoint = "/var/lib";
|
mountpoint = "/var/lib";
|
||||||
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_lib";
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_lib";
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/.snapshot-latest/bitwarden_rs"
|
"bitwarden_rs"
|
||||||
"/var/lib/.snapshot-latest/caddy"
|
"caddy"
|
||||||
"/var/lib/.snapshot-latest/gitea"
|
"gitea"
|
||||||
"/var/lib/.snapshot-latest/grafana"
|
"grafana"
|
||||||
"/var/lib/.snapshot-latest/headscale"
|
"headscale"
|
||||||
"/var/lib/.snapshot-latest/matrix-synapse"
|
"matrix-synapse"
|
||||||
"/var/lib/.snapshot-latest/nsd-acme"
|
"nsd-acme"
|
||||||
"/var/lib/.snapshot-latest/tailscale"
|
"tailscale"
|
||||||
"/var/lib/.snapshot-latest/private/soju"
|
"private/soju"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:01:00";
|
backup_at = "*-*-* 00:01:00";
|
||||||
}
|
}
|
||||||
@ -79,15 +79,15 @@
|
|||||||
mountpoint = "/var/lib";
|
mountpoint = "/var/lib";
|
||||||
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-var_lib";
|
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-var_lib";
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/.snapshot-latest/bitwarden_rs"
|
"bitwarden_rs"
|
||||||
"/var/lib/.snapshot-latest/caddy"
|
"caddy"
|
||||||
"/var/lib/.snapshot-latest/gitea"
|
"gitea"
|
||||||
"/var/lib/.snapshot-latest/grafana"
|
"grafana"
|
||||||
"/var/lib/.snapshot-latest/headscale"
|
"headscale"
|
||||||
"/var/lib/.snapshot-latest/matrix-synapse"
|
"matrix-synapse"
|
||||||
"/var/lib/.snapshot-latest/nsd-acme"
|
"nsd-acme"
|
||||||
"/var/lib/.snapshot-latest/tailscale"
|
"tailscale"
|
||||||
"/var/lib/.snapshot-latest/private/soju"
|
"private/soju"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:01:00";
|
backup_at = "*-*-* 00:01:00";
|
||||||
}
|
}
|
||||||
@ -96,9 +96,9 @@
|
|||||||
{
|
{
|
||||||
mountpoint = "/var/log";
|
mountpoint = "/var/log";
|
||||||
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_log";
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-var_log";
|
||||||
paths = ["/var/log/.snapshot-latest/caddy/"];
|
paths = ["caddy"];
|
||||||
patterns = [
|
patterns = [
|
||||||
"+ /var/log/.snapshot-latest/caddy/access-jakstys.lt.log-*.zst"
|
"+ caddy/access-jakstys.lt.log-*.zst"
|
||||||
"- *"
|
"- *"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:02:00";
|
backup_at = "*-*-* 00:02:00";
|
||||||
@ -106,9 +106,9 @@
|
|||||||
{
|
{
|
||||||
mountpoint = "/var/log";
|
mountpoint = "/var/log";
|
||||||
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-var_log";
|
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-var_log";
|
||||||
paths = ["/var/log/.snapshot-latest/caddy/"];
|
paths = ["caddy"];
|
||||||
patterns = [
|
patterns = [
|
||||||
"+ /var/log/.snapshot-latest/caddy/access-jakstys.lt.log-*.zst"
|
"+ caddy/access-jakstys.lt.log-*.zst"
|
||||||
"- *"
|
"- *"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:02:00";
|
backup_at = "*-*-* 00:02:00";
|
||||||
@ -119,8 +119,8 @@
|
|||||||
mountpoint = "/home";
|
mountpoint = "/home";
|
||||||
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
repo = "zh2769@zh2769.rsync.net:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
||||||
paths = [
|
paths = [
|
||||||
"/home/.snapshot-latest/motiejus/annex2"
|
"motiejus/annex2"
|
||||||
"/home/.snapshot-latest/motiejus/.config/syncthing"
|
"motiejus/.config/syncthing"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:05:00 UTC";
|
backup_at = "*-*-* 00:05:00 UTC";
|
||||||
}
|
}
|
||||||
@ -128,8 +128,8 @@
|
|||||||
mountpoint = "/home";
|
mountpoint = "/home";
|
||||||
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
repo = "borgstor@${myData.hosts."vno3-rp3b.servers.jakst".jakstIP}:${config.networking.hostName}.${config.networking.domain}-home-motiejus-annex2";
|
||||||
paths = [
|
paths = [
|
||||||
"/home/.snapshot-latest/motiejus/annex2"
|
"motiejus/annex2"
|
||||||
"/home/.snapshot-latest/motiejus/.config/syncthing"
|
"motiejus/.config/syncthing"
|
||||||
];
|
];
|
||||||
backup_at = "*-*-* 00:05:00 UTC";
|
backup_at = "*-*-* 00:05:00 UTC";
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,14 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
mountLatest = mountpoint: zfs_name: ''
|
mkPreHook = mountpoint: zfs_name: ''
|
||||||
set -x
|
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 {
|
in {
|
||||||
options.mj.base.zfsborg = with lib.types; {
|
options.mj.base.zfsborg = with lib.types; {
|
||||||
@ -25,7 +30,7 @@ in {
|
|||||||
options = {
|
options = {
|
||||||
mountpoint = lib.mkOption {type = path;};
|
mountpoint = lib.mkOption {type = path;};
|
||||||
repo = lib.mkOption {type = str;};
|
repo = lib.mkOption {type = str;};
|
||||||
paths = lib.mkOption {type = listOf path;};
|
paths = lib.mkOption {type = listOf str;};
|
||||||
patterns = lib.mkOption {
|
patterns = lib.mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
@ -87,7 +92,7 @@ in {
|
|||||||
extraArgs = "--remote-path=borg1";
|
extraArgs = "--remote-path=borg1";
|
||||||
compression = "auto,lzma";
|
compression = "auto,lzma";
|
||||||
startAt = attrs.backup_at;
|
startAt = attrs.backup_at;
|
||||||
preHook = mountLatest mountpoint fs.device;
|
preHook = mkPreHook mountpoint fs.device;
|
||||||
prune.keep = {
|
prune.keep = {
|
||||||
within = "1d";
|
within = "1d";
|
||||||
daily = 7;
|
daily = 7;
|
||||||
|
Loading…
Reference in New Issue
Block a user