mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2026-04-14 13:19:09 +02:00
43 lines
1.8 KiB
Nix
43 lines
1.8 KiB
Nix
{ pkgs, lib, config, globals, dns, confLib, ... }:
|
|
let
|
|
inherit (confLib.gen { name = "jenkins"; port = 8088; }) servicePort serviceName serviceDomain serviceAddress proxyAddress4 proxyAddress6;
|
|
inherit (confLib.static) isHome isProxied webProxy homeWebProxy dnsServer homeProxyIf webProxyIf homeServiceAddress nginxAccessRules;
|
|
in
|
|
{
|
|
options.swarselmodules.server.${serviceName} = lib.mkEnableOption "enable ${serviceName} on server";
|
|
config = lib.mkIf config.swarselmodules.server.${serviceName} {
|
|
|
|
globals = {
|
|
networks = {
|
|
${webProxyIf}.hosts = lib.mkIf isProxied {
|
|
${config.node.name}.firewallRuleForNode.${webProxy}.allowedTCPPorts = [ servicePort ];
|
|
};
|
|
${homeProxyIf}.hosts = lib.mkIf isHome {
|
|
${config.node.name}.firewallRuleForNode.${homeWebProxy}.allowedTCPPorts = [ servicePort ];
|
|
};
|
|
};
|
|
services.${serviceName} = {
|
|
domain = serviceDomain;
|
|
inherit proxyAddress4 proxyAddress6 isHome;
|
|
};
|
|
};
|
|
|
|
services.jenkins = {
|
|
enable = true;
|
|
withCLI = true;
|
|
port = servicePort;
|
|
packages = [ pkgs.stdenv pkgs.git pkgs.jdk17 config.programs.ssh.package pkgs.nix ];
|
|
listenAddress = "0.0.0.0";
|
|
home = "/Vault/apps/${serviceName}";
|
|
};
|
|
|
|
nodes = {
|
|
${dnsServer}.swarselsystems.server.dns.${globals.services.${serviceName}.baseDomain}.subdomainRecords = {
|
|
"${globals.services.${serviceName}.subDomain}" = dns.lib.combinators.host proxyAddress4 proxyAddress6;
|
|
};
|
|
${webProxy}.services.nginx = confLib.genNginx { inherit serviceAddress servicePort serviceDomain serviceName; maxBody = 0; };
|
|
${homeWebProxy}.services.nginx = lib.mkIf isHome (confLib.genNginx { inherit servicePort serviceDomain serviceName; maxBody = 0; extraConfig = nginxAccessRules; serviceAddress = homeServiceAddress; });
|
|
};
|
|
|
|
};
|
|
}
|