Files
nixos/hosts/common/optional/selfhosted/seafile/thumbnail/default.nix
T
aloslider c92b90e406 Small modules config restructure
Changed variables names in every module
2026-10-31 19:48:50 +03:00

55 lines
1.5 KiB
Nix

{ config, lib, ... }:
with lib;
let
rootCfg = config.selfhosted;
common = rootCfg.common;
moduleCfg = rootCfg.seafile;
cfg = moduleCfg.thumbnail;
hostDataPath = "${common.dataDir}/seafile";
in
{
imports = [ ./config.nix ];
options.selfhosted.seafile.thumbnail = {
name = mkOption {
type = types.str;
};
hostHttpPort = mkOption {
type = types.port;
};
};
config = mkIf moduleCfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
image = "docker.io/seafileltd/thumbnail-server:13.0.20";
ports = [
"0.0.0.0:${toString cfg.hostHttpPort}:80"
];
environmentFiles = [ config.sops.templates."seafile-thumbnail.env".path ];
volumes = [
"${hostDataPath}/server/shared:/shared"
];
log-driver = "journald";
extraOptions = [
"--network=${common.network.name}"
];
};
systemd.services."${common.backend}-${cfg.name}" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
requires = [
"${common.backend}-${moduleCfg.mariadb.name}.service"
"${common.backend}-${moduleCfg.server.name}.service"
];
after = [
"${common.backend}-${moduleCfg.mariadb.name}.service"
"${common.backend}-${moduleCfg.server.name}.service"
];
};
};
}