mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Persist state of actual, filebrowser, memos, radicale and syncthing
This commit is contained in:
parent
eff39a6ccd
commit
1b9a26c494
5 changed files with 42 additions and 17 deletions
|
|
@ -1,6 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.custom.services.actualbudget;
|
||||
|
||||
inherit (config.services.actual.settings) dataDir;
|
||||
in
|
||||
{
|
||||
options.custom.services.actualbudget = {
|
||||
|
|
@ -30,9 +32,13 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
custom.services.resticBackups.actual = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "actual.service";
|
||||
paths = [ config.services.actual.settings.dataDir ];
|
||||
custom = {
|
||||
services.resticBackups.actual = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "actual.service";
|
||||
paths = [ dataDir ];
|
||||
};
|
||||
|
||||
persist.directories = [ dataDir ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.custom.services.filebrowser;
|
||||
|
||||
dataDirs = with config.services.filebrowser.settings; [
|
||||
database
|
||||
root
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [ "${inputs.nixpkgs-unstable}/nixos/modules/services/web-apps/filebrowser.nix" ];
|
||||
|
|
@ -40,12 +45,13 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
custom.services.resticBackups.filebrowser = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "filebrowser.service";
|
||||
paths = with config.services.filebrowser.settings; [
|
||||
database
|
||||
root
|
||||
];
|
||||
custom = {
|
||||
services.resticBackups.filebrowser = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "filebrowser.service";
|
||||
paths = dataDirs;
|
||||
};
|
||||
|
||||
persist.directories = dataDirs;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,5 +43,7 @@ in
|
|||
MEMOS_INSTANCE_URL = "https://${cfg.domain}";
|
||||
};
|
||||
};
|
||||
|
||||
custom.persist.directories = [ config.services.memos.settings.MEMOS_DATA ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.custom.services.radicale;
|
||||
|
||||
dataDir = config.services.radicale.settings.storage.filesystem_folder;
|
||||
in
|
||||
{
|
||||
options.custom.services.radicale = {
|
||||
|
|
@ -88,7 +90,7 @@ in
|
|||
name = "radicale-git-init";
|
||||
runtimeInputs = [ pkgs.git ];
|
||||
text = ''
|
||||
cd ${config.services.radicale.settings.storage.filesystem_folder}
|
||||
cd ${dataDir}
|
||||
|
||||
if [[ ! -e .git ]]; then
|
||||
git init --initial-branch main
|
||||
|
|
@ -106,9 +108,12 @@ in
|
|||
}
|
||||
);
|
||||
|
||||
custom.services.resticBackups.radicale = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "radicale.service";
|
||||
paths = [ config.services.radicale.settings.storage.filesystem_folder ];
|
||||
custom = {
|
||||
services.resticBackups.radicale = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "radicale.service";
|
||||
paths = [ dataDir ];
|
||||
};
|
||||
persist.directories = [ dataDir ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ let
|
|||
cfg = config.custom.services.syncthing;
|
||||
tailscaleCfg = config.custom.services.tailscale;
|
||||
|
||||
inherit (config.services.syncthing) dataDir;
|
||||
|
||||
useStaticTls = config.custom.sops.secrets |> lib.hasAttr "syncthing";
|
||||
in
|
||||
{
|
||||
|
|
@ -99,7 +101,7 @@ in
|
|||
genFolders =
|
||||
folders:
|
||||
lib.genAttrs folders (name: {
|
||||
path = "${config.services.syncthing.dataDir}/${name}";
|
||||
path = "${dataDir}/${name}";
|
||||
ignorePerms = false;
|
||||
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
||||
});
|
||||
|
|
@ -125,9 +127,13 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
custom.services.resticBackups.syncthing = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "syncthing.service";
|
||||
paths = [ config.services.syncthing.dataDir ];
|
||||
custom = {
|
||||
services.resticBackups.syncthing = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "syncthing.service";
|
||||
paths = [ dataDir ];
|
||||
};
|
||||
|
||||
persist.directories = [ dataDir ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue