Add selfhosted services

This commit is contained in:
aloslider
2026-06-30 04:26:40 +03:00
parent f212c874b5
commit 13e407847f
78 changed files with 2346 additions and 690 deletions
@@ -0,0 +1,23 @@
{ config, ... }:
let
fullDomain = "${config.selfhosted.netbird.subdomain}.${config.sops.placeholder."domains/serv"}";
in
{
sops.templates."nb-dashboard.env".content = ''
NETBIRD_MGMT_API_ENDPOINT=https://${fullDomain}
NETBIRD_MGMT_GRPC_API_ENDPOINT=https://${fullDomain}
# Initial NB setup: custom OIDCP is added manually in panel later
AUTH_AUTHORITY=https://${fullDomain}/oauth2
AUTH_AUDIENCE=netbird-dashboard
AUTH_CLIENT_ID=netbird-dashboard
AUTH_CLIENT_SECRET=
USE_AUTH0=false
AUTH_SUPPORTED_SCOPES=openid profile email groups
AUTH_REDIRECT_URI=/nb-auth
AUTH_SILENT_REDIRECT_URI=/nb-silent-auth
LETSENCRYPT_DOMAIN=none
LETSENCRYPT_EMAIL=${config.sops.placeholder."letsEncrypt/email"}
'';
}
@@ -0,0 +1,43 @@
{ config, lib, ... }:
with lib;
let
common = config.selfhosted.common;
cfg = config.selfhosted.netbird;
in
{
imports = [ ./config.nix ];
options.selfhosted.netbird.dashboard = {
name = mkOption {
type = types.str;
};
};
config = {
virtualisation.oci-containers.containers.${cfg.dashboard.name} = {
image = "netbirdio/dashboard:latest";
environmentFiles = [ config.sops.templates."nb-dashboard.env".path ];
log-driver = "journald";
extraOptions = [
"--network-alias=${cfg.dashboard.name}"
"--network=${common.network.name}"
];
};
systemd.services."${common.backend}-${cfg.dashboard.name}" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [
"${common.backend}-${cfg.server.name}.service"
"${common.backend}-${config.selfhosted.traefik.name}.service"
];
requires = [
"${common.backend}-${cfg.server.name}.service"
"${common.backend}-${config.selfhosted.traefik.name}.service"
];
partOf = [ "${common.backend}-${cfg.targetName}.target" ];
wantedBy = [ "${common.backend}-${cfg.targetName}.target" ];
};
};
}