mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{ lib, config, globals, ... }:
|
|
let
|
|
servicePort = 8888;
|
|
serviceName = "atuin";
|
|
serviceDomain = config.repo.secrets.common.services.domains.${serviceName};
|
|
serviceAddress = globals.hosts.winters.ipv4;
|
|
in
|
|
{
|
|
options.swarselmodules.server.${serviceName} = lib.mkEnableOption "enable ${serviceName} on server";
|
|
config = lib.mkIf config.swarselmodules.server.${serviceName} {
|
|
|
|
topology.self.services.${serviceName}.info = "https://${serviceDomain}";
|
|
globals.services.${serviceName}.domain = serviceDomain;
|
|
|
|
services.${serviceName} = {
|
|
enable = true;
|
|
host = "0.0.0.0";
|
|
port = servicePort;
|
|
openFirewall = true;
|
|
openRegistration = false;
|
|
};
|
|
|
|
nodes.moonside.services.nginx = {
|
|
upstreams = {
|
|
${serviceName} = {
|
|
servers = {
|
|
"${serviceAddress}:${builtins.toString servicePort}" = { };
|
|
};
|
|
};
|
|
};
|
|
virtualHosts = {
|
|
"${serviceDomain}" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://${serviceName}";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
}
|