nixos/applications/ldap/backend.nix
Brendan Golden 70a83bd97b
All checks were successful
Build_Deploy / linter (push) Successful in 10s
Build_Deploy / build (push) Successful in 19s
Build_Deploy / deploy_dns (push) Successful in 1m13s
Build_Deploy / deploy_active (active) (push) Successful in 48s
Build_Deploy / deploy_active (active-core) (push) Successful in 1m43s
Build_Deploy / deploy_active (active-ext) (push) Successful in 34s
fix: ldap has no need for discord stuff
2024-11-18 12:20:02 +00:00

79 lines
1.8 KiB
Nix

{
config,
pkgs,
lib,
inputs,
...
}:
with lib; let
name = "ldap_backend";
cfg = config.services.skynet."${name}";
port_backend = "8087";
in {
imports = [
inputs.skynet_ldap_backend.nixosModule."x86_64-linux"
../../config/users.nix
];
options.services.skynet."${name}" = {
enable = mkEnableOption "Skynet LDAP backend server";
domain = {
tld = mkOption {
type = types.str;
default = "ie";
};
base = mkOption {
type = types.str;
default = "skynet";
};
sub = mkOption {
type = types.str;
default = "api.account";
};
};
};
config = mkIf cfg.enable {
#backups = [ "/etc/silver_ul_ical/database.db" ];
age.secrets.ldap_details.file = ../../secrets/ldap/details.age;
age.secrets.ldap_mail.file = ../../secrets/email/details.age;
age.secrets.ldap_wolves.file = ../../secrets/wolves/details.age;
services.skynet.acme.domains = [
"${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}"
];
services.skynet.dns.records = [
{
record = cfg.domain.sub;
r_type = "CNAME";
value = config.services.skynet.host.name;
}
];
services.nginx.virtualHosts."${cfg.domain.sub}.${cfg.domain.base}.${cfg.domain.tld}" = {
forceSSL = true;
useACMEHost = "skynet";
locations."/".proxyPass = "http://localhost:${port_backend}";
};
# this got imported
services.skynet_ldap_backend = {
enable = true;
# contains teh password in env form
env = {
ldap = config.age.secrets.ldap_details.path;
mail = config.age.secrets.ldap_mail.path;
wolves = config.age.secrets.ldap_wolves.path;
};
host_port = "127.0.0.1:${port_backend}";
users = config.skynet.users;
};
};
}