feat: configured syncthing and photoprism

This commit is contained in:
Nick 2025-12-14 01:52:25 -06:00
parent 77dcbe3c33
commit 8eb9ed31fc
8 changed files with 161 additions and 92 deletions

View file

@ -1,63 +1,11 @@
{
config,
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
envFile = "backblaze/env";
repoFile = "backblaze/repo";
passFile = "restic/pass";
importList =
let
content = builtins.readDir ./.;
dirContent = builtins.filter (n: content.${n} == "directory") (builtins.attrNames content);
in
map (name: ./. + "/${name}") dirContent;
in
{
services.restic = {
backups = {
remote = {
environmentFile = config.sops.secrets.${envFile}.path;
initialize = true;
passwordFile = config.sops.secrets.${passFile}.path;
repositoryFile = config.sops.secrets.${repoFile}.path;
timerConfig = {
OnCalendar = "0/4:00";
Persistent = true;
};
paths =
let
inst = instance: interface: instances.${instance}.interfaces.${interface}.paths.mntPaths.path0;
in
[
"/home/${user0}/.ssh"
(inst "forgejo" "interface0")
(inst "mastodon" "interface0")
(inst "opencloud" "interface1")
(inst "minecraft" "interface0")
(inst "minecraft" "interface1")
((inst "jellyfin" "interface0") + "/cache")
((inst "jellyfin" "interface0") + "/data")
((inst "jellyfin" "interface0") + "/media/music")
];
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
imports = importList;
}

View file

@ -0,0 +1,64 @@
{
config,
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.machines.devices) ceres;
inherit (flake.config.people) user0;
envFile = "backblaze/${ceres.name}-env";
repoFile = "backblaze/${ceres.name}-repo";
passFile = "restic/${ceres.name}-pass";
in
{
services.restic = {
backups = {
remote = {
initialize = true;
environmentFile = config.sops.secrets.${envFile}.path;
passwordFile = config.sops.secrets.${passFile}.path;
repositoryFile = config.sops.secrets.${repoFile}.path;
timerConfig = {
OnCalendar = "0/4:00";
Persistent = true;
};
paths =
let
inst = instance: interface: instances.${instance}.interfaces.${interface}.paths.mntPaths.path0;
in
[
"/home/${user0}/.ssh"
(inst "forgejo" "interface0")
(inst "mastodon" "interface0")
(inst "opencloud" "interface1")
(inst "minecraft" "interface0")
(inst "minecraft" "interface1")
((inst "jellyfin" "interface0") + "/cache")
((inst "jellyfin" "interface0") + "/data")
((inst "jellyfin" "interface0") + "/media/music")
];
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
}

View file

@ -0,0 +1,52 @@
{
config,
flake,
...
}:
let
inherit (flake.config.machines.devices) eris;
inherit (flake.config.people) user0;
envFile = "backblaze/${eris.name}-env";
repoFile = "backblaze/${eris.name}-repo";
passFile = "restic/${eris.name}-pass";
in
{
services.restic = {
backups = {
remote = {
environmentFile = config.sops.secrets.${envFile}.path;
initialize = true;
passwordFile = config.sops.secrets.${passFile}.path;
repositoryFile = config.sops.secrets.${repoFile}.path;
timerConfig = {
OnCalendar = "0/4:00";
Persistent = true;
};
paths = [
"/home/${user0}/.ssh"
"/mnt/storage"
];
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
}