mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-16 19:38:01 -06:00
feat: configured syncthing and photoprism
This commit is contained in:
parent
77dcbe3c33
commit
8eb9ed31fc
8 changed files with 161 additions and 92 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
flake,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -37,9 +38,13 @@ in
|
|||
PHOTOPRISM_ADMIN_USER = user;
|
||||
PHOTOPRISM_DISABLE_TLS = "true";
|
||||
PHOTOPRISM_DEFAULT_LOCAL = "en";
|
||||
PHOTOPRISM_BACKUP_DATABASE = "false";
|
||||
PHOTOPRISM_BACKUP_ALBUMS = "true";
|
||||
PHOTOPRISM_SIDECAR_YAML = "true";
|
||||
PHOTOPRISM_READONLY = "true";
|
||||
PHOTOPRISM_INDEX_SCHEDULE = "0 2 * * *";
|
||||
};
|
||||
passwordFile = "/etc/photoprism-secrets/${user}-pass";
|
||||
# databasePasswordFile = "/etc/photoprism-secrets/${user}-pass";
|
||||
storagePath = "/var/lib/${serviceCfg.name}";
|
||||
originalsPath = "/var/lib/${serviceCfg.name}-media";
|
||||
address = "0.0.0.0";
|
||||
|
|
@ -67,34 +72,29 @@ in
|
|||
|
||||
systemd = {
|
||||
services = {
|
||||
# fix-secrets-permissions = {
|
||||
# description = "Fix secrets permissions for photoprism";
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# before = [
|
||||
# "photoprism.service"
|
||||
# ];
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# };
|
||||
# script = ''
|
||||
# mkdir -p /etc/photoprism-secrets
|
||||
# cp /run/secrets/${user}-pass /etc/photoprism-secrets/${user}-pass
|
||||
# chmod 755 /etc/photoprism-secrets
|
||||
# chmod 644 /etc/photoprism-secrets/*
|
||||
# '';
|
||||
# };
|
||||
photoprism-secrets = {
|
||||
description = "Setup photoprism secrets";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "photoprism.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
mkdir -p /etc/photoprism-secrets
|
||||
cp /run/secrets/${user}-pass /etc/photoprism-secrets/${user}-pass
|
||||
chmod 755 /etc/photoprism-secrets
|
||||
chmod 644 /etc/photoprism-secrets/${user}-pass
|
||||
'';
|
||||
};
|
||||
photoprism = {
|
||||
serviceConfig = {
|
||||
DynamicUser = lib.mkForce false;
|
||||
User = serviceCfg.name;
|
||||
Group = serviceCfg.name;
|
||||
# Override LoadCredential to use our secrets path
|
||||
LoadCredential = lib.mkForce [
|
||||
"PHOTOPRISM_ADMIN_PASSWORD_FILE:/run/secrets/${user}-pass"
|
||||
];
|
||||
StateDirectory = lib.mkForce [ ];
|
||||
StateDirectoryMode = lib.mkForce null;
|
||||
};
|
||||
# Make sure secrets are mounted before service starts
|
||||
after = [ "run-secrets.mount" ];
|
||||
requires = [ "run-secrets.mount" ];
|
||||
};
|
||||
|
|
@ -124,8 +124,8 @@ in
|
|||
};
|
||||
|
||||
microvm = {
|
||||
vcpu = 1;
|
||||
mem = 512;
|
||||
vcpu = 2;
|
||||
mem = 1024 * 4;
|
||||
hypervisor = "qemu";
|
||||
interfaces = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
flake,
|
||||
lib,
|
||||
pkgs,
|
||||
labHelpers,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (import ../../../helpers.nix { inherit flake; }) labHelpers;
|
||||
inherit (labHelpers) guestPath mediaPath;
|
||||
inherit (import ../config { inherit flake lib; }) photoprismVM;
|
||||
inherit (import ../config { inherit flake lib pkgs; }) photoprismVM;
|
||||
inherit (flake.config.services.instances) photoprism;
|
||||
inherit (flake.config.people) user0;
|
||||
interfaceCfg = photoprism.interfaces.interface0;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.services.instances) syncthing;
|
||||
inherit (import ../../../../helpers.nix { inherit flake; }) labHelpers;
|
||||
inherit (import ../../../helpers.nix { inherit flake; }) labHelpers;
|
||||
inherit (labHelpers) mediaPath docsPath miscPath;
|
||||
serviceCfg = syncthing;
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue