mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
made snapshot_manager.nix
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
./nix.nix
|
./nix.nix
|
||||||
./programs.nix
|
./programs.nix
|
||||||
./ssh.nix
|
./ssh.nix
|
||||||
|
./snapshot_manager.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|||||||
29
systems/common/global/snapshot_config.toml
Normal file
29
systems/common/global/snapshot_config.toml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
["default"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/home"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 14
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/root"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/nix"]
|
||||||
|
15_min = 4
|
||||||
|
hourly = 0
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|
||||||
|
["root_pool/var"]
|
||||||
|
15_min = 8
|
||||||
|
hourly = 24
|
||||||
|
daily = 30
|
||||||
|
monthly = 6
|
||||||
44
systems/common/global/snapshot_manager.nix
Normal file
44
systems/common/global/snapshot_manager.nix
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{ inputs, pkgs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.snapshot_manager;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.snapshot_manager = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
default = true;
|
||||||
|
example = true;
|
||||||
|
description = "Whether to enable k3s-net.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = "Path that needs to be updated via git pull";
|
||||||
|
default = ./snapshot_config.toml;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd = {
|
||||||
|
services."snapshot_manager" = {
|
||||||
|
description = "ZFS Snapshot Manager";
|
||||||
|
requires = [ "zfs-import.target" ];
|
||||||
|
after = [ "zfs-import.target" ];
|
||||||
|
path = [ pkgs.zfs ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${inputs.system_tools.packages.x86_64-linux.default}/bin/snapshot_manager --config-file='${cfg.path}'";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
timers."snapshot_manager" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "15m";
|
||||||
|
OnUnitActiveSec = "15m";
|
||||||
|
Unit = "snapshot_manager.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user