Restructure to focus on nix.
This commit is contained in:
parent
6952570818
commit
588fdbd9f2
19 changed files with 4 additions and 25 deletions
|
|
@ -1,70 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
cfg = config.foehammer.backups.restic;
|
||||
in {
|
||||
options.foehammer.backups.restic = {
|
||||
enable = mkEnableOption "Enable restic backups";
|
||||
|
||||
repositoryFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
};
|
||||
|
||||
environmentFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
paths = mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
default = [];
|
||||
};
|
||||
|
||||
exclude = mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.groups.restic = {};
|
||||
users.users.restic = {
|
||||
isSystemUser = true;
|
||||
group = "restic";
|
||||
};
|
||||
|
||||
security.wrappers.restic = {
|
||||
source = "${pkgs.restic.out}/bin/restic";
|
||||
owner = "restic";
|
||||
group = "restic";
|
||||
permissions = "u=rwx,g=,o=";
|
||||
capabilities = "cap_dac_read_search=+ep";
|
||||
};
|
||||
|
||||
services.restic.backups = {
|
||||
remote = {
|
||||
paths = cfg.paths;
|
||||
exclude = cfg.exclude;
|
||||
user = "restic";
|
||||
|
||||
initialize = true;
|
||||
|
||||
repositoryFile = cfg.repositoryFile;
|
||||
environmentFile = cfg.environmentFile;
|
||||
passwordFile = cfg.passwordFile;
|
||||
|
||||
pruneOpts = [
|
||||
"--keep-daily 7"
|
||||
"--keep-weekly 4"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue