72 lines
1.9 KiB
Nix
Raw Normal View History

2025-07-08 20:14:14 +03:00
{ config, lib, ... }:
let
inherit (lib)
mkEnableOption
mkIf
mkOption
recursiveUpdate
;
inherit (lib.types) bool;
inherit (config.virtualisation.quadlet) networks;
2025-07-08 20:14:14 +03:00
cfg = config.ataraxia.containers.filestash;
nginx = config.ataraxia.services.nginx;
2025-07-08 20:14:14 +03:00
nas-path = "/media/nas/media-stack";
domain = "files.ataraxiadev.com";
port = "8334";
2025-07-08 20:14:14 +03:00
in
{
options.ataraxia.containers.filestash = {
enable = mkEnableOption "Enable filestash container";
nginxHost = mkOption {
type = bool;
default = config.ataraxia.services.nginx.enable;
description = "Enable nginx vHost integration";
};
2025-07-08 20:14:14 +03:00
};
config = mkIf cfg.enable {
virtualisation.quadlet.containers.filestash = {
2025-07-08 20:14:14 +03:00
autoStart = true;
containerConfig = {
environments = {
PUID = "1000";
PGID = "100";
UMASK = "002";
TZ = "Europe/Moscow";
APPLICATION_URL = domain;
CANARY = "true";
};
# Tags: latest
image = "docker.io/machines/filestash@sha256:923c3399768fada3424bb6f3bc01521dad30e9a7a840cfb2eba3610b6acafffe";
networks = [ networks.br-services.ref ];
publishPorts = [ "127.0.0.1:${port}:${port}/tcp" ];
volumes = [
"${nas-path}/configs/filestash:/app/data/state"
"${nas-path}:/mnt"
];
2025-07-08 20:14:14 +03:00
};
};
services.nginx.virtualHosts = mkIf cfg.nginxHost {
${domain} = recursiveUpdate nginx.defaultSettings {
locations."/" = {
proxyPass = "http://127.0.0.1:${port}";
proxyWebsockets = true;
extraConfig = ''
allow 127.0.0.1/32;
allow 100.64.0.0/16;
allow 10.10.10.0/24;
allow fd7a:115c:a1e0::/64;
deny all;
proxy_busy_buffers_size 1024k;
proxy_buffers 32 1024k;
proxy_buffer_size 1024k;
proxy_read_timeout 86400;
'';
};
};
};
2025-07-08 20:14:14 +03:00
};
}