From 32282ae39d352428988891207fb4f276a311846a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 6 Feb 2022 21:20:24 +0100 Subject: vidhar: borg --- modules/borgbackup/btrfs-snapshots.nix | 52 ---------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 modules/borgbackup/btrfs-snapshots.nix (limited to 'modules/borgbackup/btrfs-snapshots.nix') diff --git a/modules/borgbackup/btrfs-snapshots.nix b/modules/borgbackup/btrfs-snapshots.nix deleted file mode 100644 index 96d2b2ba..00000000 --- a/modules/borgbackup/btrfs-snapshots.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.btrfs-snapshots; - - snapshotMount = str: "${str}${cfg.mountSuffix}"; -in { - options = { - - services.btrfs-snapshots = { - enable = mkEnableOption "a systemd unit for btrfs snapshots"; - - mountSuffix = mkOption { - type = types.str; - default = ".snapshot"; - }; - - readOnly = mkOption { - type = types.bool; - default = true; - }; - - persist = mkOption { - type = types.bool; - default = false; - }; - }; - - }; - - - config = mkIf cfg.enable { - systemd.services."btrfs-snapshot@" = { - enable = true; - - unitConfig = { - StopWhenUnneeded = !cfg.persist; - }; - - serviceConfig = with pkgs; { - Type = "oneshot"; - ExecStartPre = "-${btrfs-progs}/bin/btrfs subvolume delete -c ${snapshotMount "%f"}"; - ExecStart = "${btrfs-progs}/bin/btrfs subvolume snapshot ${optionalString cfg.readOnly "-r"} %f ${snapshotMount "%f"}"; - RemainAfterExit = true; - ExecStop = "${btrfs-progs}/bin/btrfs subvolume delete -c ${snapshotMount "%f"}"; - }; - }; - - }; -} -- cgit v1.2.3