Jump to content

Immich: Difference between revisions

From NixOS Wiki
Onny (talk | contribs)
Inital page
 
Updated the immich hardware acceleration docs to reflect the changes in https://github.com/NixOS/nixpkgs/pull/376339
 
(16 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[https://immich.app 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.
[https://immich.app Immich] is a self-hosted photo and video management solution.


== Setup ==
== Installation ==
To install Immich, add the following to your NixOS configuration:
{{file|/etc/nixos/configuration.nix|nix|3=services.immich.enable = true;
services.immich.port = 2283;}}
More options are available: {{nixos:option|services.immich.}}


{{Note|The module is not yet part of the latest NixOS stable release and will be available with version 24.11.}}
== Tips and Tricks ==


The following example configuration will enable Immich locally
=== Enabling Hardware Accelerated Video Transcoding ===
Add the Immich user to the <code>render</code> and <code>video</code> groups, override the <code>PrivateDevices</code> service config setting to allow the service to access <code>/dev/dri/</code> and enable [[Accelerated Video Playback]] on your system:{{file|/etc/nixos/configuration.nix|nix|3=# `null` will give access to all devices.
# You may want to restrict this by using something like `[ "/dev/dri/renderD128" ]`
services.immich.accelerationDevices = null;


{{file|/etc/nixos/configuration.nix|nix|3=environment.etc."immich-typsense-api-key".text = "12318551487654187654";
hardware.graphics = {
services.immich = {
# ...
  enable = true;
# See: https://wiki.nixos.org/wiki/Accelerated_Video_Playback
  server.typesense.apiKeyFile = "/etc/immich-typsense-api-key";
};
};


services.typesense = {
users.users.immich.extraGroups = [ "video" "render" ]; }}
  enable = true;
 
  # In a real setup you should generate an api key for immich
=== Using Immich behind Nginx ===
  # and not use the admin key!
  apiKeyFile = "/etc/immich-typsense-api-key";
  settings.server.api-address = "127.0.0.1";
};


services.postgresql = {
This is a typical [[Nginx]] configuration for Immich:
   enable = true;
{{file|/etc/nixos/configuration.nix|nix|3=services.nginx.virtualHosts."immich.example.com" = {
   identMap = ''
   enableACME = true;
    # ArbitraryMapName systemUser DBUser
   forceSSL = true;
     superuser_map      root      postgres
  locations."/" = {
    superuser_map      postgres  postgres
     proxyPass = "http://[::1]:${toString config.services.immich.port}";
    # Let other names login as themselves
     proxyWebsockets = true;
    superuser_map      /^(.*)$  \1
    recommendedProxySettings = true;
  '';
    extraConfig = ''
  authentication = pkgs.lib.mkOverride 10 ''
      client_max_body_size 50000M;
     local sameuser all peer map=superuser_map
       proxy_read_timeout  600s;
  '';
       proxy_send_timeout  600s;
  ensureDatabases = [ "immich" ];
       send_timeout        600s;
  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 <code>admin</code> and password <code>admin</code>.
}}


[[Category:Server]]
[[Category:Server]]
[[Category:Web Applications]]
[[Category:Web Applications]]

Latest revision as of 07:33, 5 February 2025

Immich is a self-hosted photo and video management solution.

Installation

To install Immich, add the following to your NixOS configuration:

/etc/nixos/configuration.nix
services.immich.enable = true;
services.immich.port = 2283;

More options are available: services.immich.

Tips and Tricks

Enabling Hardware Accelerated Video Transcoding

Add the Immich user to the render and video groups, override the PrivateDevices service config setting to allow the service to access /dev/dri/ and enable Accelerated Video Playback on your system:

/etc/nixos/configuration.nix
# `null` will give access to all devices.
# You may want to restrict this by using something like `[ "/dev/dri/renderD128" ]`
services.immich.accelerationDevices = null;

hardware.graphics = { 
 # ...
 # See: https://wiki.nixos.org/wiki/Accelerated_Video_Playback
};

users.users.immich.extraGroups = [ "video" "render" ];

Using Immich behind Nginx

This is a typical Nginx configuration for Immich:

/etc/nixos/configuration.nix
services.nginx.virtualHosts."immich.example.com" = {
  enableACME = true;
  forceSSL = true;
  locations."/" = {
    proxyPass = "http://[::1]:${toString config.services.immich.port}";
    proxyWebsockets = true;
    recommendedProxySettings = true;
    extraConfig = ''
      client_max_body_size 50000M;
      proxy_read_timeout   600s;
      proxy_send_timeout   600s;
      send_timeout         600s;
    '';
  };
};