restic: Parameterise extra paths and excludes
This commit is contained in:
parent
5937065d0e
commit
b435e1a182
|
@ -12,7 +12,12 @@
|
||||||
gpu.amd.enable = true;
|
gpu.amd.enable = true;
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
libvirt.enable = true;
|
libvirt.enable = true;
|
||||||
restic.enable = true;
|
restic = {
|
||||||
|
enable = true;
|
||||||
|
extraPaths = [
|
||||||
|
"/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
ssd.enable = true;
|
ssd.enable = true;
|
||||||
wireguard.home = {
|
wireguard.home = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -27,9 +27,8 @@ let
|
||||||
|
|
||||||
# Docker (state should be kept somewhere else)
|
# Docker (state should be kept somewhere else)
|
||||||
"/var/lib/docker/"
|
"/var/lib/docker/"
|
||||||
];
|
] ++ cfg.extraExcludes;
|
||||||
excludesFile = pkgs.writeText "exludes.txt" (builtins.concatStringsSep "\n" excludes);
|
excludesFile = pkgs.writeText "exludes.txt" (builtins.concatStringsSep "\n" excludes);
|
||||||
maybePath = path: (lib.optional (builtins.pathExists path) (toString path));
|
|
||||||
|
|
||||||
# script to use restic as user without dealing with authentication
|
# script to use restic as user without dealing with authentication
|
||||||
authScript = pkgs.writeShellScriptBin "restic-auth" ''
|
authScript = pkgs.writeShellScriptBin "restic-auth" ''
|
||||||
|
@ -57,6 +56,15 @@ in
|
||||||
RandomizedDelaySec = "2h";
|
RandomizedDelaySec = "2h";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
extraPaths = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "/data" ];
|
||||||
|
};
|
||||||
|
extraExcludes = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@ -64,13 +72,11 @@ in
|
||||||
inherit repository;
|
inherit repository;
|
||||||
passwordFile = toString <secrets/restic-password>;
|
passwordFile = toString <secrets/restic-password>;
|
||||||
s3CredentialsFile = toString <secrets/restic-s3>;
|
s3CredentialsFile = toString <secrets/restic-s3>;
|
||||||
paths = lib.mkDefault (
|
paths = [
|
||||||
[ ]
|
"/home"
|
||||||
++ maybePath /data
|
"/srv"
|
||||||
++ maybePath /home
|
"/var"
|
||||||
++ maybePath /srv
|
] ++ cfg.extraPaths;
|
||||||
++ maybePath /var
|
|
||||||
);
|
|
||||||
initialize = true;
|
initialize = true;
|
||||||
extraBackupArgs = [
|
extraBackupArgs = [
|
||||||
"--exclude-caches"
|
"--exclude-caches"
|
||||||
|
|
Loading…
Reference in a new issue