Personal-use NixOS configuration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Immich service

encode42 16b2c414 dcfd52b6

+126
+35
hosts/index/config/web/immich.nix
··· 1 + { flakeRoot, ... }: 2 + 3 + let 4 + host = "photos.encrypted.group"; 5 + 6 + immichModule = import (flakeRoot + /packages/server/web/immich.nix) { 7 + hosts = [ 8 + { 9 + name = "immich.lan"; 10 + ssl = "internal"; 11 + } 12 + { 13 + name = host; 14 + ssl = "cloudflare"; 15 + } 16 + ]; 17 + }; 18 + in 19 + { 20 + imports = [ 21 + immichModule 22 + ]; 23 + 24 + services.immich = { 25 + settings = { 26 + server = { 27 + externalDomain = "https://${host}"; 28 + }; 29 + }; 30 + 31 + mediaLocation = "/mnt/data/immich"; 32 + }; 33 + 34 + systemd.services.immich-server.serviceConfig.ReadWritePaths = [ "/mnt/data/immich" ]; 35 + }
+1
hosts/index/default.nix
··· 40 40 41 41 ./config/web/caddy.nix 42 42 ./config/web/forgejo.nix 43 + ./config/web/immich.nix 43 44 ./config/web/miniflux.nix 44 45 ./config/web/searx.nix 45 46 ./config/web/vaultwarden.nix
+90
packages/server/web/immich.nix
··· 1 + { 2 + hosts ? [ ], 3 + }: 4 + 5 + { 6 + config, 7 + flakeLib, 8 + ... 9 + }: 10 + 11 + let 12 + videoDevice = "/dev/dri/renderD128"; 13 + in 14 + { 15 + imports = [ 16 + ../databases/postgresql.nix 17 + ../databases/redis.nix 18 + ]; 19 + 20 + services.immich = { 21 + enable = true; 22 + 23 + host = "127.0.0.1"; 24 + 25 + accelerationDevices = [ videoDevice ]; 26 + 27 + database = { 28 + enableVectors = false; 29 + enableVectorChord = true; 30 + }; 31 + 32 + settings = { 33 + trash.days = 31; 34 + 35 + image = { 36 + thumbnail = { 37 + size = 240; 38 + quality = 50; 39 + }; 40 + 41 + preview = { 42 + format = "webp"; 43 + size = 1080; 44 + quality = 75; 45 + }; 46 + }; 47 + 48 + ffmpeg = { 49 + acceptedContainers = [ "webm" ]; 50 + acceptedVideoCodecs = [ "hevc" "vp9" "av1" ]; 51 + acceptedAudioCodecs = [ "libopus" ]; 52 + 53 + targetVideoCodec = "hevc"; 54 + targetAudioCodec = "libopus"; 55 + 56 + crf = 31; 57 + #maxBitrate = 2600; 58 + twoPass = true; 59 + 60 + # assumes AMD GPU, to modularize 61 + accel = "vaapi"; 62 + preferredHwDevice = videoDevice; 63 + accelDecode = true; 64 + }; 65 + 66 + machineLearning = { 67 + # Assumes the machine is powerful, while balancing speed 68 + # "ViT-B-32__laion2b-s34b-b79k" uses a third of the memory and is ~twice as fast, but is ~10% less accurate 69 + clip.modelName = "ViT-B-16-SigLIP2__webli"; 70 + 71 + facialRecognition = { 72 + # Largest model, generally very accurate 73 + modelName = "antelopev2"; 74 + 75 + minScore = 0.5; 76 + minFaces = 5; 77 + }; 78 + }; 79 + 80 + # Assumes we're keeping copies elsewhere (zfs snapshots) 81 + backup.database.enabled = false; 82 + }; 83 + }; 84 + 85 + users.users.immich.extraGroups = [ "video" "render" ]; 86 + 87 + services.caddy.virtualHosts = flakeLib.mkProxies hosts '' 88 + reverse_proxy :${toString config.services.immich.port} 89 + ''; 90 + }