mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2026-01-03 06:29:54 +01:00
treewide: Group media services in modules/services/media
This commit is contained in:
parent
e9951968c7
commit
b494b01a9c
11 changed files with 15 additions and 9 deletions
96
modules/services/media/photos/default.nix
Normal file
96
modules/services/media/photos/default.nix
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
# self-hosted photo gallery
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.photos;
|
||||
inherit (config.networking) domain;
|
||||
inherit (config.services.immich) port;
|
||||
in
|
||||
{
|
||||
options.my.services.photos = {
|
||||
enable = lib.mkEnableOption "Photos gallery";
|
||||
|
||||
secretsFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
pass secrets
|
||||
'';
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = { };
|
||||
description = ''
|
||||
see <https://immich.app/docs/install/config-file/>.
|
||||
'';
|
||||
};
|
||||
|
||||
path = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = null;
|
||||
example = "/data/photos";
|
||||
description = ''
|
||||
Storage path of your original media files (photos and videos)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.immich = {
|
||||
enable = true;
|
||||
# mediaLocation = path;
|
||||
inherit (cfg) secretsFile;
|
||||
settings = {
|
||||
ffmpeg.transcode = "disabled";
|
||||
server.externalDomain = "https://photos.${domain}";
|
||||
}
|
||||
// cfg.settings;
|
||||
environment = {
|
||||
IMMICH_TELEMETRY_INCLUDE = "all";
|
||||
IMMICH_API_METRICS_PORT = toString (port + 1);
|
||||
IMMICH_MICROSERVICES_METRICS_PORT = toString (port + 2);
|
||||
};
|
||||
};
|
||||
|
||||
services.prometheus = {
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "immich";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "localhost:${toString (port + 1)}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
service = "api";
|
||||
};
|
||||
}
|
||||
{
|
||||
targets = [ "localhost:${toString (port + 2)}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
service = "server";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
my.services.webserver.virtualHosts = [
|
||||
{
|
||||
subdomain = "photos";
|
||||
inherit port;
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.photos = {
|
||||
dashboard = {
|
||||
name = "Photos";
|
||||
category = "media";
|
||||
icon = "image";
|
||||
url = "https://photos.${domain}";
|
||||
method = "get";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue