privatemounts = false is required if snap is separate from the backup service.

This commit is contained in:
Joseph Hanson 2025-02-09 19:24:36 -06:00
parent e782f7c268
commit 4a4cce4e94
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o

View file

@ -3,9 +3,7 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.mySystem.services.zfs-nightly-snap; cfg = config.mySystem.services.zfs-nightly-snap;
# Replaces/Creates and mounts a ZFS snapshot # Replaces/Creates and mounts a ZFS snapshot
@ -62,8 +60,7 @@ let
mount | grep "$BACKUP_DIRECTORY" mount | grep "$BACKUP_DIRECTORY"
''; '';
}; };
in in {
{
options.mySystem.services.zfs-nightly-snap = { options.mySystem.services.zfs-nightly-snap = {
enable = lib.mkEnableOption "ZFS nightly snapshot service"; enable = lib.mkEnableOption "ZFS nightly snapshot service";
@ -115,6 +112,7 @@ in
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${resticSnapAndMount}/bin/zfs-nightly-snap"; ExecStart = "${resticSnapAndMount}/bin/zfs-nightly-snap";
PrivateMounts = "no"; # We want to mount the snapshot to the system
}; };
requires = ["zfs.target"]; requires = ["zfs.target"];
after = ["zfs.target"]; after = ["zfs.target"];