[immich] Adds but disabled Immich because it's crashing on start-up
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
{
|
||||
imports = [
|
||||
./chat.nix
|
||||
# Currently disabled because it doesn't start up properly
|
||||
# ./immich.nix
|
||||
./storyden.nix
|
||||
./tandoor.nix
|
||||
];
|
||||
|
||||
73
system/hosts/mcp/containers/havenisms.com/immich.nix
Normal file
73
system/hosts/mcp/containers/havenisms.com/immich.nix
Normal file
@@ -0,0 +1,73 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
inherit (import ../lib.nix config) havenisms mkPostgresContainer;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(mkPostgresContainer {
|
||||
# Immich wants a custom build of postgres with the vectors extensions.
|
||||
image = "ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:c44be5f2871c59362966d71eab4268170eb6f5653c0e6170184e72b38ffdf107";
|
||||
name = "immich";
|
||||
directory = "/tank/immich/db";
|
||||
uid = config.users.users.immich.uid;
|
||||
gid = config.users.groups.immich.gid;
|
||||
passwordSecret = "immich/database";
|
||||
})
|
||||
];
|
||||
|
||||
sops.secrets = {
|
||||
"immich/database" = {
|
||||
restartUnits = [
|
||||
"${config.local.container-backend}-immich-db.service"
|
||||
];
|
||||
mode = "0400";
|
||||
owner = config.users.users.immich.name;
|
||||
};
|
||||
};
|
||||
|
||||
sops.templates."immich.env" = {
|
||||
restartUnits = [ "${config.local.container-backend}-immich.service" ];
|
||||
owner = config.users.users.immich.name;
|
||||
content = ''
|
||||
DB_HOSTNAME=immich-postgres
|
||||
DB_PASSWORD=${config.sops.placeholder."immich/database"}
|
||||
DB_USERNAME=immich
|
||||
DB_DATABASE_NAME=immich
|
||||
REDIS_HOSTNAME=immich-redis
|
||||
IMMICH_LOG_LEVEL=verbose
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.web-containers.containers.immich = {
|
||||
image = "ghcr.io/immich-app/immich-server:release";
|
||||
hostname = "immich";
|
||||
domain = havenisms;
|
||||
port = 2283;
|
||||
volumes = [
|
||||
"/tank/photos/immich:/data"
|
||||
"/etc/localtime:/etc/localtime:ro"
|
||||
];
|
||||
dependsOn = [
|
||||
"immich-redis"
|
||||
"immich-postgres"
|
||||
];
|
||||
environmentFiles = [
|
||||
"${config.sops.templates."immich.env".path}"
|
||||
];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers = {
|
||||
"immich-redis" = {
|
||||
image = "docker.io/valkey/valkey";
|
||||
};
|
||||
"immich-machine-learning" = {
|
||||
image = "ghcr.io/immich-app/immich-machine-learning:release";
|
||||
volumes = [
|
||||
"model-cache:/cache"
|
||||
];
|
||||
environmentFiles = [
|
||||
"${config.sops.templates."immich.env".path}"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -70,15 +70,14 @@ in
|
||||
extraOptions
|
||||
;
|
||||
autoStart = true;
|
||||
labels =
|
||||
{
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.${hostName}.rule" = "${routerRule}";
|
||||
"traefik.http.services.${hostName}.loadbalancer.server.port" = "${toString port}";
|
||||
}
|
||||
// oauthLabels
|
||||
// homepageLabels
|
||||
// extraLabels;
|
||||
labels = {
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.${hostName}.rule" = "${routerRule}";
|
||||
"traefik.http.services.${hostName}.loadbalancer.server.port" = "${toString port}";
|
||||
}
|
||||
// oauthLabels
|
||||
// homepageLabels
|
||||
// extraLabels;
|
||||
};
|
||||
|
||||
# Creates a MariaDB container for a specific app. It should be safe to give
|
||||
@@ -127,11 +126,12 @@ in
|
||||
containerName ? "${name}-postgres",
|
||||
databaseName ? name,
|
||||
username ? name,
|
||||
image ? "postgres",
|
||||
}:
|
||||
{ config, ... }:
|
||||
{
|
||||
virtualisation.oci-containers.containers."${containerName}" = {
|
||||
image = "postgres";
|
||||
inherit image;
|
||||
autoStart = true;
|
||||
volumes = [
|
||||
# Note that data must be mounted at this location to persist.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{ pkgs, ... }: let
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
systemUsers = {
|
||||
gitea = {
|
||||
uid = 2001;
|
||||
@@ -19,6 +20,7 @@
|
||||
home = "/tank/web";
|
||||
packages = [ pkgs.git ];
|
||||
};
|
||||
immich = 2009;
|
||||
};
|
||||
|
||||
mkUser = name: value: {
|
||||
@@ -27,25 +29,30 @@
|
||||
description = "System User for ${name}";
|
||||
group = "${name}";
|
||||
shell = value.shell or null;
|
||||
extraGroups = value.extraGroups or [];
|
||||
openssh.authorizedKeys.keys = value.authorizedKeys or [];
|
||||
extraGroups = value.extraGroups or [ ];
|
||||
openssh.authorizedKeys.keys = value.authorizedKeys or [ ];
|
||||
home = value.home or "/var/empty";
|
||||
packages = value.packages or [];
|
||||
packages = value.packages or [ ];
|
||||
};
|
||||
mkGroup = name: value: let
|
||||
# 1. Value if int
|
||||
# 2. "gid" if present
|
||||
# 3. "uid"
|
||||
gid =
|
||||
if builtins.isInt value
|
||||
then value
|
||||
else if builtins.hasAttr "gid" value
|
||||
then value.gid
|
||||
else value.uid;
|
||||
in {
|
||||
inherit gid;
|
||||
};
|
||||
in {
|
||||
mkGroup =
|
||||
name: value:
|
||||
let
|
||||
# 1. Value if int
|
||||
# 2. "gid" if present
|
||||
# 3. "uid"
|
||||
gid =
|
||||
if builtins.isInt value then
|
||||
value
|
||||
else if builtins.hasAttr "gid" value then
|
||||
value.gid
|
||||
else
|
||||
value.uid;
|
||||
in
|
||||
{
|
||||
inherit gid;
|
||||
};
|
||||
in
|
||||
{
|
||||
users.users = builtins.mapAttrs mkUser systemUsers;
|
||||
users.groups = (builtins.mapAttrs mkGroup systemUsers) // {
|
||||
# Legacy groups.
|
||||
|
||||
Reference in New Issue
Block a user