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