|
@@ -1,12 +1,14 @@
|
|
|
-{ config, ... }:
|
|
|
|
|
|
|
+{ config, lib, pkgs, ... }:
|
|
|
let
|
|
let
|
|
|
cfg = config.services.immich;
|
|
cfg = config.services.immich;
|
|
|
domain = "photos.t5.st";
|
|
domain = "photos.t5.st";
|
|
|
|
|
+ go-avahi-cname = lib.getExe pkgs.unstable.go-avahi-cname;
|
|
|
in
|
|
in
|
|
|
{
|
|
{
|
|
|
services.immich = {
|
|
services.immich = {
|
|
|
enable = true;
|
|
enable = true;
|
|
|
- host = "127.0.0.1";
|
|
|
|
|
|
|
+ host = "0.0.0.0";
|
|
|
|
|
+ openFirewall = true;
|
|
|
mediaLocation = "/mnt/storage/immich";
|
|
mediaLocation = "/mnt/storage/immich";
|
|
|
group = "storage";
|
|
group = "storage";
|
|
|
accelerationDevices = [ "/dev/dri/renderD128" ];
|
|
accelerationDevices = [ "/dev/dri/renderD128" ];
|
|
@@ -41,15 +43,35 @@ in
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
services.caddy.virtualHosts.immich = {
|
|
services.caddy.virtualHosts.immich = {
|
|
|
- hostName = "photos.{$DOMAIN}";
|
|
|
|
|
|
|
+ hostName = "http://photos.odin.local";
|
|
|
|
|
+ serverAliases = [ "photos.odin.t5.st" ];
|
|
|
extraConfig = ''
|
|
extraConfig = ''
|
|
|
encode gzip zstd
|
|
encode gzip zstd
|
|
|
reverse_proxy ${cfg.host}:${toString cfg.port}
|
|
reverse_proxy ${cfg.host}:${toString cfg.port}
|
|
|
'';
|
|
'';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ systemd.services.photos-local = {
|
|
|
|
|
+ description = "Avahi photos.odin.local domain";
|
|
|
|
|
+ wantedBy = [ "multi-user.target" ];
|
|
|
|
|
+ after = [
|
|
|
|
|
+ "network.target"
|
|
|
|
|
+ "avahi-daemon.service"
|
|
|
|
|
+ ];
|
|
|
|
|
+ requires = [ "avahi-daemon.service" ];
|
|
|
|
|
+
|
|
|
|
|
+ serviceConfig = {
|
|
|
|
|
+ Type = "simple";
|
|
|
|
|
+ User = "root";
|
|
|
|
|
+ ExecStart = "${go-avahi-cname} cname photos";
|
|
|
|
|
+ Restart = "always";
|
|
|
|
|
+ RestartSec = "10";
|
|
|
|
|
+ };
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
systemd.tmpfiles.rules = [
|
|
systemd.tmpfiles.rules = [
|
|
|
"d /mnt/storage/immich 0770 immich storage - -"
|
|
"d /mnt/storage/immich 0770 immich storage - -"
|
|
|
|
|
+ "d /var/cache/immich 0770 immich storage - -"
|
|
|
"d /var/cache/immich/mpl 0700 immich storage - -"
|
|
"d /var/cache/immich/mpl 0700 immich storage - -"
|
|
|
"d /var/cache/immich/encoded-video 0700 immich storage - -"
|
|
"d /var/cache/immich/encoded-video 0700 immich storage - -"
|
|
|
"d /var/cache/immich/profile 0700 immich storage - -"
|
|
"d /var/cache/immich/profile 0700 immich storage - -"
|
|
@@ -57,9 +79,9 @@ in
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
system.activationScripts.createSymlink = ''
|
|
system.activationScripts.createSymlink = ''
|
|
|
- ln -sf /mnt/storage/immich/encoded-video /var/cache/immich/encoded-video
|
|
|
|
|
- ln -sf /mnt/storage/immich/profile /var/cache/immich/profile
|
|
|
|
|
- ln -sf /mnt/storage/immich/thumbs /var/cache/immich/thumbs
|
|
|
|
|
|
|
+ ln -sf /var/cache/immich/encoded-video /mnt/storage/immich/encoded-video
|
|
|
|
|
+ ln -sf /var/cache/immich/profile /mnt/storage/immich/profile
|
|
|
|
|
+ ln -sf /var/cache/immich/thumbs /mnt/storage/immich/thumbs
|
|
|
'';
|
|
'';
|
|
|
|
|
|
|
|
services.samba.settings = {
|
|
services.samba.settings = {
|