nix: refactor modules pass 2

This commit is contained in:
Primrose 2025-04-01 21:40:43 +02:00
parent ec7246e524
commit 1716faf2cd
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
19 changed files with 11 additions and 11 deletions

View file

@ -1,100 +0,0 @@
{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"
];
};
};
}