mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nix: refactor modules pass 2
This commit is contained in:
parent
ec7246e524
commit
1716faf2cd
19 changed files with 11 additions and 11 deletions
100
nix/configurations/vanadium/nixos/restic.nix
Normal file
100
nix/configurations/vanadium/nixos/restic.nix
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
{config, ...}: {
|
||||
services.restic.backups = let
|
||||
pruneOpts = [
|
||||
"--keep-daily 7"
|
||||
"--keep-weekly 4"
|
||||
"--keep-monthly 12"
|
||||
"--keep-yearly 10"
|
||||
];
|
||||
in {
|
||||
"backblaze" = {
|
||||
paths = [
|
||||
"/home/leana/Documents"
|
||||
"/home/leana/Calibre"
|
||||
];
|
||||
|
||||
passwordFile = config.age.secrets.restic_backblaze_pwd.path;
|
||||
repositoryFile = config.age.secrets.restic_backblaze_repo.path;
|
||||
environmentFile = config.age.secrets.restic_backblaze_env.path;
|
||||
|
||||
inherit pruneOpts;
|
||||
};
|
||||
|
||||
"four" = {
|
||||
paths = [
|
||||
"/home/leana/Music"
|
||||
"/home/leana/Documents"
|
||||
"/home/leana/Calibre"
|
||||
"/home/leana/Images"
|
||||
];
|
||||
|
||||
repository = "/mnt/four/restic";
|
||||
passwordFile = config.age.secrets.restic_four_pwd.path;
|
||||
|
||||
timerConfig = null;
|
||||
|
||||
inherit pruneOpts;
|
||||
};
|
||||
|
||||
"sgbk" = {
|
||||
paths = [
|
||||
"/home/leana/Music"
|
||||
"/home/leana/Documents"
|
||||
"/home/leana/Calibre"
|
||||
"/home/leana/Images"
|
||||
];
|
||||
|
||||
timerConfig = null;
|
||||
|
||||
repository = "/mnt/sgbk/restic";
|
||||
passwordFile = config.age.secrets.restic_sgbk_pwd.path;
|
||||
|
||||
inherit pruneOpts;
|
||||
};
|
||||
|
||||
"two-to-four" = {
|
||||
paths = ["/mnt/two"];
|
||||
|
||||
timerConfig = null;
|
||||
|
||||
repository = "/mnt/four/restic";
|
||||
passwordFile = config.age.secrets.restic_four_pwd.path;
|
||||
|
||||
exclude = ["lost+found"];
|
||||
|
||||
inherit pruneOpts;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
# TODO:
|
||||
# Wait for upstream to introduce direct access to unitConfig
|
||||
# c.f. https://github.com/NixOS/nixpkgs/pull/368234
|
||||
"restic-backups-four" = {
|
||||
requires = ["mnt-four.mount"];
|
||||
after = ["mnt-four.mount"];
|
||||
unitConfig.PropagatesStopTo = ["mnt-four.mount"];
|
||||
};
|
||||
|
||||
"restic-backups-sgbk" = {
|
||||
requires = ["mnt-sgbk.mount"];
|
||||
after = ["mnt-sgbk.mount"];
|
||||
unitConfig.PropagatesStopTo = ["mnt-sgbk.mount"];
|
||||
};
|
||||
|
||||
"restic-backups-two-to-four" = {
|
||||
requires = [
|
||||
"mnt-two.mount"
|
||||
"mnt-four.mount"
|
||||
];
|
||||
after = [
|
||||
"mnt-two.mount"
|
||||
"mnt-four.mount"
|
||||
];
|
||||
unitConfig.PropagatesStopTo = [
|
||||
"mnt-two.mount"
|
||||
"mnt-four.mount"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue