feat(immich): migrate Lyra to native NixOS services #218
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:electra
host:fleet
host:lyra
host:nova
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!218
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-31-native-immich"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/mnt/immich, migrate the restored database paths, and preserve the Docker stack as the rollback source.Validation
nix flake checkpasses.{"res":"pong"}from/api/server/ping.Follow-up
CUDAExecutionProviderand a real ML job on Lyra.Refs #31
Automated code review
Reviewed commit:
21cd109e553d04bea17764da03c58a53fe1f5bafVerdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The PR migrates Immich from Docker to native NixOS services, splitting the stack across two hosts: Vega (PostgreSQL) and Lyra (Application/ML). It introduces new modules for database setup and service configuration, configures SOPS secrets with specific age keys, and enables CUDA acceleration on Lyra's RTX 4070. The diff shows careful systemd ordering for PostgreSQL extensions and password setting, as well as NFS mount dependencies.
Blocking findings
None.
Important findings
The
systemd.servicesblock forimmich-serverandimmich-machine-learningsetsrequires = [ "network-online.target" "sops-nix.service" ];andafter = [ ... ]. It does not includenebula@mesh.service. However, the NFS mount (line 108) correctly requires Nebula, and the Immich service depends on the NFS mount viaRequiresMountsFor. Since the database host is a Nebula address (10.10.0.2), if the network stack initializes but Nebula routing is not yet established when Immich starts (even with retries), it may fail to connect.Impact: Potential transient connection failures during boot if Nebula connectivity is slower than the Immich service startup/retry logic.
Suggested fix: Add
wants = [ "nebula@mesh.service" ];andafter = [ "nebula@mesh.service" ];to the Immich systemd units to ensure network routing is ready before attempting database connections.Suggestions
Hardcoded CUDA compute capability (hosts/lyra/default.nix:98; medium confidence)
nixpkgs.config.cudaCapabilities = [ "8.9" ];is hardcoded.Impact: This is correct for the RTX 4070 (Ada Lovelace). It reduces build times and binary size. If hardware changes, this must be updated manually.
Suggested fix: Consider documenting this assumption or making it an option if future hardware upgrades are anticipated.
SOPS key rotation complexity (.sops.yaml:387; medium confidence)
The
secrets/immich.yamlfile includes multiple age keys (vega, lyra, yubikey-nano5c, yubikey-5-nfc, provision-key).Impact: Rotating these keys requires re-encrypting the secret with the new key set and distributing it to all authorized parties.
Suggested fix: Ensure the team is aware of the key rotation procedure for this specific secret file.
Tests and validation
Questions
immichNixOS module been verified to handle database connection retries gracefully if PostgreSQL is not immediately available at boot?Review limitations
nix flake checkor deploy the configuration to verify runtime behavior.Diff coverage
.sops.yaml: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchhosts/vega/default.nix: reviewed — included in a context-limited batchmodules/databases/immich.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchsecrets/immich.yaml: reviewed — included in a context-limited batchReview metadata