photoprism-test-vm/photoprism.nix

62 lines
1.5 KiB
Nix

{ lib, modulesPath, pkgs, ... }:
{
services.photoprism = {
enable = true;
port = 2342;
settings = {
PHOTOPRISM_DEFAULT_LOCALE = "fr";
PHOTOPRISM_ADMIN_USERNAME = "admin";
PHOHOPRISM_SITE_URL = "https://photoprism.cgiga.fr";
PHOTOPRISM_SITE_CAPTION = "PhotoPrism";
# DB access config
PHOTOPRISM_DATABASE_DRIVER = "mysql";
PHOTOPRISM_DATABASE_NAME = "photoprism";
PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock";
PHOTOPRISM_DATABASE_USER = "photoprism";
};
originalsPath = "/data/photos";
address = "localhost";
#importPath = "/photoprism/imports";
#passwordFile = "/passwords/photoprism";
};
services.mysql = {
enable = true;
dataDir = "/data/mysql";
package = pkgs.mariadb;
ensureDatabases = [ "photoprism" ];
ensureUsers = [{
name = "photoprism";
ensurePermissions = {
"photoprism.*" = "ALL PRIVILEGES";
};
}];
};
services.nginx.virtualHosts."photoprism.cgiga.fr" = {
enableACME = true;
forceSSL = true;
serverAliases = [];
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
clientMaxBodySize = "500m";
locations."/" = {
proxyPass = "http://localhost:2342/";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_buffering off;
proxy_http_version 1.1;
'';
};
};
}