mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
30 lines
1.2 KiB
Nix
30 lines
1.2 KiB
Nix
{ config, lib, globals, ... }:
|
|
{
|
|
_module.args = {
|
|
confLib = rec {
|
|
|
|
addressDefault = if config.swarselsystems.proxyHost != config.node.name then globals.networks."${if config.swarselsystems.isCloud then config.node.name else "home"}-${config.swarselsystems.server.localNetwork}".hosts.${config.node.name}.ipv4 else "localhost";
|
|
|
|
domainDefault = service: config.repo.secrets.common.services.domains.${service};
|
|
proxyDefault = config.swarselsystems.proxyHost;
|
|
|
|
getConfig = config;
|
|
|
|
gen = { name, user ? name, group ? name, dir ? null, port ? null, domain ? (domainDefault name), address ? addressDefault, proxy ? proxyDefault }: rec {
|
|
servicePort = port;
|
|
serviceName = name;
|
|
specificServiceName = "${name}-${config.node.name}";
|
|
serviceUser = user;
|
|
serviceGroup = group;
|
|
serviceDomain = domain;
|
|
baseDomain = lib.swarselsystems.getBaseDomain domain;
|
|
subDomain = lib.swarselsystems.getSubDomain domain;
|
|
serviceDir = dir;
|
|
serviceAddress = address;
|
|
serviceProxy = proxy;
|
|
proxyAddress4 = globals.hosts.${proxy}.wanAddress4;
|
|
proxyAddress6 = globals.hosts.${proxy}.wanAddress6 or null;
|
|
};
|
|
};
|
|
};
|
|
}
|