btrfssnapshot: make it somewhat work
This commit is contained in:
parent
43697386b8
commit
7970c36801
@ -79,6 +79,22 @@ in
|
|||||||
verboseLogs = true;
|
verboseLogs = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
btrfssnapshot = {
|
||||||
|
enable = true;
|
||||||
|
subvolumes = {
|
||||||
|
"/home" = {
|
||||||
|
label = "5minutely";
|
||||||
|
keep = 12;
|
||||||
|
refreshInterval = "*:0/5";
|
||||||
|
};
|
||||||
|
#"/home" = {
|
||||||
|
# label = "hourly";
|
||||||
|
# keep = 24;
|
||||||
|
# refreshInterval = "*:00:00";
|
||||||
|
#};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
wifibackup = {
|
wifibackup = {
|
||||||
enable = true;
|
enable = true;
|
||||||
toPath = "/home/${config.mj.username}/M-Active/.wifi";
|
toPath = "/home/${config.mj.username}/M-Active/.wifi";
|
||||||
|
@ -11,7 +11,6 @@ in
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./boot
|
./boot
|
||||||
./btrfssnapshot
|
|
||||||
./fileSystems
|
./fileSystems
|
||||||
./snapshot
|
./snapshot
|
||||||
./sshd
|
./sshd
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mj.base.btrfssnapshot;
|
cfg = config.mj.services.btrfssnapshot;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mj.base.btrfssnapshot = {
|
options.mj.services.btrfssnapshot = {
|
||||||
enable = lib.mkEnableOption "Enable btrfs snapshots";
|
enable = lib.mkEnableOption "Enable btrfs snapshots";
|
||||||
|
|
||||||
subvolumes = lib.mkOption {
|
subvolumes = lib.mkOption {
|
||||||
@ -30,10 +30,10 @@ in
|
|||||||
services = lib.mapAttrs' (
|
services = lib.mapAttrs' (
|
||||||
subvolume: params:
|
subvolume: params:
|
||||||
lib.nameValuePair "btrfs-snapshot-${lib.strings.sanitizeDerivationName subvolume}" {
|
lib.nameValuePair "btrfs-snapshot-${lib.strings.sanitizeDerivationName subvolume}" {
|
||||||
description = "${params.label} btrfs snapshot for ${subvolume} (keep ${params.keep}";
|
description = "${params.label} btrfs snapshot for ${subvolume} (keep ${builtins.toString params.keep})";
|
||||||
serviceConfig.ExecStart = "${pkgs.btrfs-auto-snapshot} --verbose --label=${params.label} --keep=${params.keep} ${subvolume}";
|
serviceConfig.ExecStart = "${pkgs.btrfs-auto-snapshot}/bin/btrfs-auto-snapshot --verbose --label=${params.label} --keep=${builtins.toString params.keep} ${subvolume}";
|
||||||
}
|
}
|
||||||
);
|
) cfg.subvolumes;
|
||||||
|
|
||||||
timers = lib.mapAttrs' (
|
timers = lib.mapAttrs' (
|
||||||
subvolume: params:
|
subvolume: params:
|
||||||
@ -42,7 +42,7 @@ in
|
|||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
timerConfig.OnCalendar = params.refreshInterval;
|
timerConfig.OnCalendar = params.refreshInterval;
|
||||||
}
|
}
|
||||||
);
|
) cfg.subvolumes;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./borgstor
|
./borgstor
|
||||||
|
./btrfssnapshot
|
||||||
./deployerbot
|
./deployerbot
|
||||||
./friendlyport
|
./friendlyport
|
||||||
./gitea
|
./gitea
|
||||||
|
@ -61,6 +61,9 @@ au FileType yaml setlocal ts=2 sw=2 sts=2
|
|||||||
au FileType sql setlocal formatprg=pg_format\ -
|
au FileType sql setlocal formatprg=pg_format\ -
|
||||||
au FileType sql setlocal ts=2 sw=2 sts=2
|
au FileType sql setlocal ts=2 sw=2 sts=2
|
||||||
|
|
||||||
|
" nix
|
||||||
|
au FileType nix setlocal ts=2 sw=2 sts=2
|
||||||
|
|
||||||
" mail
|
" mail
|
||||||
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
|
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user