sys: add immich

This commit is contained in:
Fabian Montero 2026-05-25 01:42:53 -06:00
parent ac7e67dc61
commit d39f60d75c
Signed by: fabian
GPG key ID: 3EDA9AE3937CCDE3
3 changed files with 80 additions and 0 deletions

View file

@ -17,6 +17,7 @@
./steam.nix
./gtklock.nix
./borgsync.nix
./immich.nix
./dufs.nix
./defaultDesktopPack.nix
./task-force-beta-bot.nix

74
sys/modules/immich.nix Normal file
View file

@ -0,0 +1,74 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.local.sys.immich;
in {
options.local.sys.immich = {
enable = mkEnableOption "Immich photo/video management";
mediaLocation = mkOption {
type = types.path;
default = "/var/lib/immich";
description = "Directory for storing media files.";
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
description = "Address to listen on.";
};
port = mkOption {
type = types.port;
default = 2283;
description = "Port for the web interface.";
};
machineLearning.enable = mkOption {
type = types.bool;
default = true;
description = "Enable machine learning for smart features.";
};
accelerationDevices = mkOption {
type = with types; nullOr (listOf str);
default = null;
description = ''
Device paths for hardware-accelerated video transcoding.
null = allow all devices, [] = no acceleration.
Example: [ "/dev/dri/renderD128" ]
'';
};
group = mkOption {
type = types.str;
default = "photosgroup";
description = ''
Group for shared access to external libraries. Files in external
libraries should be owned by this group with group-read permission.
To add permisions to current dir:
`chgrp -R photosgroup . && chmod -R g+rX .`
'';
};
users = mkOption {
type = with types; listOf str;
default = [];
description = "Users to add to the photos group for managing external libraries.";
};
};
config = mkIf cfg.enable {
users.groups.${cfg.group} = {};
users.users =
{immich.extraGroups = [cfg.group];}
// genAttrs cfg.users (_: {extraGroups = [cfg.group];});
services.immich = {
enable = true;
host = cfg.host;
port = cfg.port;
mediaLocation = cfg.mediaLocation;
openFirewall = false;
machine-learning.enable = cfg.machineLearning.enable;
accelerationDevices = cfg.accelerationDevices;
};
};
}

View file

@ -25,6 +25,11 @@
];
repoName = "posixlycorrect";
};
immich = {
enable = true;
accelerationDevices = [ "/dev/dri/renderD128" ];
users = [ "fabian" ];
};
};
networking = {