mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
restic: Rename option resticBackups to restic.backups
This commit is contained in:
parent
9ec0c676be
commit
ba78828f4f
10 changed files with 17 additions and 17 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
resticBackups = config.custom.services.resticBackups |> lib.filterAttrs (_: value: value.enable);
|
backups = config.custom.services.restic.backups |> lib.filterAttrs (_: value: value.enable);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.services.resticBackups = lib.mkOption {
|
options.custom.services.restic.backups = lib.mkOption {
|
||||||
type = lib.types.attrsOf (
|
type = lib.types.attrsOf (
|
||||||
lib.types.submodule {
|
lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
|
@ -28,7 +28,7 @@ in
|
||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (resticBackups != { }) {
|
config = lib.mkIf (backups != { }) {
|
||||||
sops = {
|
sops = {
|
||||||
secrets = {
|
secrets = {
|
||||||
"backblaze/key-id" = { };
|
"backblaze/key-id" = { };
|
||||||
|
|
@ -43,10 +43,10 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules =
|
systemd.tmpfiles.rules =
|
||||||
resticBackups |> lib.attrNames |> lib.map (name: "d /var/cache/restic-backups-${name} 700 - - -");
|
backups |> lib.attrNames |> lib.map (name: "d /var/cache/restic-backups-${name} 700 - - -");
|
||||||
|
|
||||||
services.restic.backups =
|
services.restic.backups =
|
||||||
resticBackups
|
backups
|
||||||
|> lib.mapAttrs (
|
|> lib.mapAttrs (
|
||||||
name: value:
|
name: value:
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
|
|
@ -71,7 +71,7 @@ in
|
||||||
);
|
);
|
||||||
|
|
||||||
systemd.services =
|
systemd.services =
|
||||||
resticBackups
|
backups
|
||||||
|> lib.mapAttrs' (
|
|> lib.mapAttrs' (
|
||||||
name: value:
|
name: value:
|
||||||
lib.nameValuePair "restic-backups-${name}" (
|
lib.nameValuePair "restic-backups-${name}" (
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
backupsWithHealthchecks =
|
backupsWithHealthchecks =
|
||||||
config.custom.services.resticBackups
|
config.custom.services.restic.backups
|
||||||
|> lib.filterAttrs (_: value: value.enable)
|
|> lib.filterAttrs (_: value: value.enable)
|
||||||
|> lib.filterAttrs (_: value: value.doHealthchecks);
|
|> lib.filterAttrs (_: value: value.doHealthchecks);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.services.resticBackups = lib.mkOption {
|
options.custom.services.restic.backups = lib.mkOption {
|
||||||
type = lib.types.attrsOf (
|
type = lib.types.attrsOf (
|
||||||
lib.types.submodule {
|
lib.types.submodule {
|
||||||
options.doHealthchecks = lib.mkEnableOption "" // {
|
options.doHealthchecks = lib.mkEnableOption "" // {
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
backupsWithRestoreCommand =
|
backupsWithRestoreCommand =
|
||||||
config.custom.services.resticBackups
|
config.custom.services.restic.backups
|
||||||
|> lib.filterAttrs (_: value: value.enable)
|
|> lib.filterAttrs (_: value: value.enable)
|
||||||
|> lib.filterAttrs (_: value: value.restoreCommand.enable);
|
|> lib.filterAttrs (_: value: value.restoreCommand.enable);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.custom.services.resticBackups = lib.mkOption {
|
options.custom.services.restic.backups = lib.mkOption {
|
||||||
type = lib.types.attrsOf (
|
type = lib.types.attrsOf (
|
||||||
lib.types.submodule {
|
lib.types.submodule {
|
||||||
options.restoreCommand = {
|
options.restoreCommand = {
|
||||||
|
|
@ -133,7 +133,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.syncthing = lib.mkIf cfg.doBackups {
|
services.restic.backups.syncthing = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "syncthing.service";
|
conflictingService = "syncthing.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.actual = lib.mkIf cfg.doBackups {
|
services.restic.backups.actual = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "actual.service";
|
conflictingService = "actual.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.filebrowser = lib.mkIf cfg.doBackups {
|
services.restic.backups.filebrowser = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "filebrowser.service";
|
conflictingService = "filebrowser.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.forgejo = lib.mkIf cfg.doBackups {
|
services.restic.backups.forgejo = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "forgejo.service";
|
conflictingService = "forgejo.service";
|
||||||
paths = [ config.services.forgejo.stateDir ];
|
paths = [ config.services.forgejo.stateDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.memos = lib.mkIf cfg.doBackups {
|
services.restic.backups.memos = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "memos.service";
|
conflictingService = "memos.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ in
|
||||||
inherit (config.services.outline) user;
|
inherit (config.services.outline) user;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.resticBackups.outline = lib.mkIf cfg.doBackups {
|
services.restic.backups.outline = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "outline.service";
|
conflictingService = "outline.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
extraConfig.backupPrepareCommand = ''
|
extraConfig.backupPrepareCommand = ''
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ in
|
||||||
);
|
);
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
services.resticBackups.radicale = lib.mkIf cfg.doBackups {
|
services.restic.backups.radicale = lib.mkIf cfg.doBackups {
|
||||||
conflictingService = "radicale.service";
|
conflictingService = "radicale.service";
|
||||||
paths = [ dataDir ];
|
paths = [ dataDir ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue