Immich

From NixOS Wiki
Revision as of 16:27, 4 June 2024 by Onny (talk | contribs) (Inital page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Immich is an open-source software, designed to provide a self-hosted alternative for managing and backing up photos and videos, with a focus on privacy and ease of use.

Setup

Note: The module is not yet part of the latest NixOS stable release and will be available with version 24.11.

The following example configuration will enable Immich locally

/etc/nixos/configuration.nix
environment.etc."immich-typsense-api-key".text = "12318551487654187654";
services.immich = {
  enable = true;
  server.typesense.apiKeyFile = "/etc/immich-typsense-api-key";
};

services.typesense = {
  enable = true;
  # In a real setup you should generate an api key for immich
  # and not use the admin key!
  apiKeyFile = "/etc/immich-typsense-api-key";
  settings.server.api-address = "127.0.0.1";
};

services.postgresql = {
  enable = true;
  identMap = ''
    # ArbitraryMapName systemUser DBUser
    superuser_map      root      postgres
    superuser_map      postgres  postgres
    # Let other names login as themselves
    superuser_map      /^(.*)$   \1
  '';
  authentication = pkgs.lib.mkOverride 10 ''
    local sameuser all peer map=superuser_map
  '';
  ensureDatabases = [ "immich" ];
  ensureUsers = [
    {
      name = "immich";
      ensurePermissions = {
        "DATABASE immich" = "ALL PRIVILEGES";
      };
    }
  ];
};

After applying the configuration you can access the instance via http://localhost:28981 and login with username admin and password admin.