added restic user options

This commit is contained in:
John Lancaster
2026-03-16 08:02:28 -05:00
parent 30c4a648ff
commit acbd86f589

View File

@@ -1,7 +1,37 @@
{ ... }: { inputs, ... }: {
flake.modules.homeManager.restic = { config, pkgs, lib, ... }:
let let
resticFactory = repoName: { cfg = config.restic;
repository = "rest:https://soteria.john-stream.com/${repoName}"; in
{
options.restic = {
repoName = lib.mkOption {
description = "Name of the restic repo to use";
type = lib.types.str;
default = "john-ubuntu";
};
passwordFile = lib.mkOption {
description = "String path to the restic password file";
type = lib.types.str;
};
paths = lib.mkOption {
description = "List of string paths to include in the backup";
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
config = {
services.restic = {
enable = true;
backups.${cfg.repoName} = {
passwordFile = cfg.passwordFile;
paths = cfg.paths;
repository = "rest:https://soteria.john-stream.com/${cfg.repoName}";
extraBackupArgs = [
"--tls-client-cert ${config.mtls.certDir}/${config.mtls.bundleFilename}"
"--cacert ${config.mtls.certDir}/root_ca.crt"
];
timerConfig = { timerConfig = {
OnCalendar = "00:05"; OnCalendar = "00:05";
Persistent = true; Persistent = true;
@@ -40,36 +70,6 @@ let
"/home/john/john-nas" "/home/john/john-nas"
]; ];
}; };
in {
flake.modules.homeManager.restic = { config, pkgs, lib, ... }:
let
cfg = config.restic;
in
{
options.restic = {
repoName = lib.mkOption {
description = "Name of the restic repo to use";
type = lib.types.str;
default = "john-ubuntu";
};
passwordFile = lib.mkOption {
description = "String path to the restic password file";
type = lib.types.str;
};
paths = lib.mkOption {
description = "List of string paths to include in the backup";
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
config = {
services.restic = {
enable = true;
backups.${cfg.repoName} = (resticFactory cfg.repoName) // {
passwordFile = cfg.passwordFile;
paths = cfg.paths;
};
}; };
}; };
}; };