zitadel #2
5 changed files with 106 additions and 49 deletions
|
|
@ -37,5 +37,9 @@ in {
|
||||||
file = ./forgejo-mailpass.age;
|
file = ./forgejo-mailpass.age;
|
||||||
owner = abstrServiceUser "forgejo";
|
owner = abstrServiceUser "forgejo";
|
||||||
};
|
};
|
||||||
|
immich-oidc = mkIf server {
|
||||||
|
file = ./immich-oidc.age;
|
||||||
|
owner = abstrServiceUser "immich";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
secrets/immich-oidc.age
Normal file
15
secrets/immich-oidc.age
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 GQzYWA MbczMCSPu7pJru1rmOsFuloCYLKlh7koC5drXcKlwiw
|
||||||
|
ZghUrcs7YT3ciwqOkrPDEzlZe3qN9ypBw3xRGYWNPaY
|
||||||
|
-> ssh-ed25519 MfR7VA KB6RE2QZ//Z6xoyQC502dJeg79rYXFJJdOwV+c6tOWo
|
||||||
|
e1zIz2nsV9JbBaadTnONrPLI5Ztyv9vf4Ewzd9uSHnU
|
||||||
|
-> ssh-ed25519 +cvRTg GntHLoUwpIrxm3FcVw+Bavaq6kLaZpVdTRLoMMVfpAY
|
||||||
|
abE1ZkhS39vylBg8bZ5K3vgnXr70Vbk1bLCKsCFlUvU
|
||||||
|
-> ssh-ed25519 WCPLrA +/GlB5CbM/1FwI5JE63DJVUChADjJfD3jJY3Y2KmXEU
|
||||||
|
pPqBhV49/wg/hWffFm2XFRGC9p1nQ57tj1YK7pPkQ3U
|
||||||
|
-> ssh-ed25519 7/ziYw lxlJVNMIqfoMPj6VGTt2V4PxFi+6WRMfOYcv1hpEMkM
|
||||||
|
kd8CI7RECJA5uPJu33D61OEnqWwZuNQ6VmYLqXew6gc
|
||||||
|
-> ssh-ed25519 VQy60Q YSgYVPPN7QutKhbv6/1vmoRnh14KXs0g2k9qxKuvQ2U
|
||||||
|
FL3fImxWoBeHrCLd+jp/a1oRd/Acgi6sV/g40dCRrTA
|
||||||
|
--- TipdjwDPkRxiV/R1FUYCm/tcD6M+XEaZhQjrzwMxiuA
|
||||||
|
証E%キZDケ<44>Ts<54>,リ5ノ
ウ<>LタO<EFBE80>ヤソzエァアヨ<>クT、<>Θ<0B>ャ煖_蕘熙H演始ロナ*ヤxQ7$釉淸v`Wネ<04>瀲t%<25>6<0C>5
|
||||||
|
|
@ -21,4 +21,5 @@ in {
|
||||||
"mail-admin.age".publicKeys = keys;
|
"mail-admin.age".publicKeys = keys;
|
||||||
"zitadel-key.age".publicKeys = keys;
|
"zitadel-key.age".publicKeys = keys;
|
||||||
"forgejo-mailpass.age".publicKeys = keys;
|
"forgejo-mailpass.age".publicKeys = keys;
|
||||||
|
"immich-oidc.age".publicKeys = keys;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ in {
|
||||||
ENABLED = true;
|
ENABLED = true;
|
||||||
SUBJECT_PREFIX = "JSWGit";
|
SUBJECT_PREFIX = "JSWGit";
|
||||||
PROTOCOL = "smtps";
|
PROTOCOL = "smtps";
|
||||||
SMTP_ADDR = "mail.jsw.tf";
|
SMTP_ADDR = "mail.jsw.tf"; #FIXME: replace with config... to stalwart setting once using stalwart nixos module.
|
||||||
SMTP_PORT = 465;
|
SMTP_PORT = 465;
|
||||||
FROM = "git@jsw.tf";
|
FROM = "git@jsw.tf";
|
||||||
USER = "git";
|
USER = "git";
|
||||||
|
|
|
||||||
|
|
@ -1,61 +1,98 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib) mkIf mkForce mkDefault;
|
||||||
|
|
||||||
cfg = config.niksos.server;
|
cfg = config.niksos.server;
|
||||||
|
oidcSubstitute = "*@#OPENIDCLIENTSECRET#@*";
|
||||||
|
config-dir = "/run/immich-conf";
|
||||||
in {
|
in {
|
||||||
services.immich = {
|
config =
|
||||||
enable = cfg;
|
mkIf cfg
|
||||||
|
{
|
||||||
|
users.users.${config.services.immich.user}.extraGroups = ["video" "render"];
|
||||||
|
services.caddy.virtualHosts."photos.jsw.tf".extraConfig = ''
|
||||||
|
reverse_proxy localhost:9002
|
||||||
|
'';
|
||||||
|
|
||||||
port = 9002;
|
services.immich = mkIf cfg {
|
||||||
machine-learning.enable = false;
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
port = 9002;
|
||||||
server.externalDomain = "https://photos.jsw.tf";
|
machine-learning.enable = false;
|
||||||
ffmpeg = {
|
|
||||||
crf = 23;
|
accelerationDevices = mkDefault null;
|
||||||
threads = 0;
|
|
||||||
preset = "ultrafast";
|
#NOTE: immich doesn't support variables in their config file, so we have to subsitute ourselfs..
|
||||||
targetVideoCodec = "h264";
|
environment.IMMICH_CONFIG_FILE = mkForce "${config-dir}/immich.json";
|
||||||
acceptedVideoCodecs = [
|
settings = {
|
||||||
"h264"
|
server.externalDomain = "https://photos.jsw.tf";
|
||||||
|
oauth = {
|
||||||
|
enabled = true;
|
||||||
|
autoLaunch = true;
|
||||||
|
autoRegister = true;
|
||||||
|
buttonText = "Login with JSWAuth";
|
||||||
|
clientId = "329735769805619570";
|
||||||
|
clientSecret = oidcSubstitute;
|
||||||
|
issuerUrl = "https://${config.services.zitadel.settings.ExternalDomain}/.well-known/openid-configuration";
|
||||||
|
};
|
||||||
|
passwordLogin.enabled = false;
|
||||||
|
ffmpeg = {
|
||||||
|
crf = 23;
|
||||||
|
threads = 0;
|
||||||
|
preset = "ultrafast";
|
||||||
|
targetVideoCodec = "h264";
|
||||||
|
acceptedVideoCodecs = [
|
||||||
|
"h264"
|
||||||
|
];
|
||||||
|
targetAudioCodec = "aac";
|
||||||
|
acceptedAudioCodecs = [
|
||||||
|
"aac"
|
||||||
|
"mp3"
|
||||||
|
"libopus"
|
||||||
|
"pcm_s16le"
|
||||||
|
];
|
||||||
|
acceptedContainers = [
|
||||||
|
"mov"
|
||||||
|
"ogg"
|
||||||
|
"webm"
|
||||||
|
];
|
||||||
|
targetResolution = "720";
|
||||||
|
maxBitrate = "0";
|
||||||
|
bframes = -1;
|
||||||
|
refs = 0;
|
||||||
|
gopSize = 0;
|
||||||
|
temporalAQ = false;
|
||||||
|
cqMode = "auto";
|
||||||
|
twoPass = false;
|
||||||
|
preferredHwDevice = lib.mkDefault "auto";
|
||||||
|
transcode = "all";
|
||||||
|
tonemap = "hable";
|
||||||
|
accel = lib.mkDefault "vaapi";
|
||||||
|
accelDecode = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
services.immich-server = {
|
||||||
|
preStart = let
|
||||||
|
refConfig = (pkgs.formats.json {}).generate "immich.json" config.services.immich.settings;
|
||||||
|
newConfig = "${config-dir}/immich.json";
|
||||||
|
replaceSecretBin = "${pkgs.replace-secret}/bin/replace-secret";
|
||||||
|
in ''
|
||||||
|
umask 077
|
||||||
|
cp -f '${refConfig}' '${newConfig}'
|
||||||
|
chmod u+w '${newConfig}'
|
||||||
|
${replaceSecretBin} '${oidcSubstitute}' '${config.age.secrets.immich-oidc.path}' '${newConfig}'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
tmpfiles.rules = [
|
||||||
|
"d ${config-dir} 0700 immich immich"
|
||||||
];
|
];
|
||||||
targetAudioCodec = "aac";
|
|
||||||
acceptedAudioCodecs = [
|
|
||||||
"aac"
|
|
||||||
"mp3"
|
|
||||||
"libopus"
|
|
||||||
"pcm_s16le"
|
|
||||||
];
|
|
||||||
acceptedContainers = [
|
|
||||||
"mov"
|
|
||||||
"ogg"
|
|
||||||
"webm"
|
|
||||||
];
|
|
||||||
targetResolution = "720";
|
|
||||||
maxBitrate = "0";
|
|
||||||
bframes = -1;
|
|
||||||
refs = 0;
|
|
||||||
gopSize = 0;
|
|
||||||
temporalAQ = false;
|
|
||||||
cqMode = "auto";
|
|
||||||
twoPass = false;
|
|
||||||
preferredHwDevice = lib.mkDefault "auto";
|
|
||||||
transcode = "all";
|
|
||||||
tonemap = "hable";
|
|
||||||
accel = lib.mkDefault "vaapi";
|
|
||||||
accelDecode = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
accelerationDevices = lib.mkDefault null;
|
|
||||||
};
|
|
||||||
users.users.immich = lib.mkIf cfg {extraGroups = ["video" "render"];}; #NOTE: was first groups = lib.mkIf.. but then users.immich gets set even when server is disabled.
|
|
||||||
|
|
||||||
services.caddy.virtualHosts."photos.jsw.tf" = {
|
|
||||||
extraConfig = ''
|
|
||||||
reverse_proxy localhost:9002
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue