My Nix Configuration

[systems] Add pocket-id service

pyrox.dev eed397be 4bd8c688

verified
Changed files
+103 -37
lib
packages
anubis-files
src
policies
systems
+9
lib/data/services.toml
···
host = "marvin"
extUrl = "xmpp.pyrox.dev"
+
[pocket-id]
+
port = 6932
+
host = "marvin"
+
extUrl = "auth.pyrox.dev"
+
anubis = 8401
+
be-port = 30101
+
be-anubis = 30102
+
+
[redlib]
port = 6901
host = "marvin"
-3
packages/anubis-files/src/policies/authentik.yaml packages/anubis-files/src/policies/pocket-id.yaml
···
- import: (data)/bots/ai-robots-txt.yaml
- import: CUSTOM/block/alibaba-cloud.yaml
- import: (data)/common/keep-internet-working.yaml
-
- name: allow-authentik-applications
-
path_regex: ^/application/o/.*$
-
action: ALLOW
- import: CUSTOM/challenge/generic-browser.yaml
dnsbl: false
+2 -1
systems/x86_64-linux/marvin/default.nix
···
# Running Services
./services/anubis.nix
-
./services/authentik.nix
+
# ./services/authentik.nix
./services/avahi.nix
./services/bots.nix
./services/deemix.nix
···
./services/nextcloud
./services/pinchflat.nix
./services/planka.nix
+
./services/pocket-id.nix
./services/podman.nix
./services/postgres.nix
./services/prometheus.nix
-7
systems/x86_64-linux/marvin/services/authentik.nix
···
owner = "thehedgehog";
group = "misc";
};
-
services.anubis.instances.authentik = {
-
settings = {
-
BIND = ":${toString d.anubis}";
-
POLICY_FNAME = "${pkgs.py.anubis-files}/policies/authentik.yaml";
-
TARGET = "http://localhost:${toString d.port}";
-
};
-
};
}
-1
systems/x86_64-linux/marvin/services/planka.nix
···
TARGET = "http://localhost:${toString d.port}";
};
};
-
}
+60
systems/x86_64-linux/marvin/services/pocket-id.nix
···
+
{
+
config,
+
lib,
+
pkgs,
+
...
+
}:
+
let
+
d = lib.py.data.services.pocket-id;
+
in
+
{
+
services.pocket-id = {
+
enable = true;
+
environmentFile = config.age.secrets.pocket-id-secrets.path;
+
settings = {
+
PUBLIC_APP_URL = "https://auth.pyrox.dev";
+
TRUST_PROXY = true;
+
UPDATE_CHECK_DISABLED = true;
+
BACKEND_PORT = 30101;
+
PORT = d.port;
+
INTERNAL_BACKEND_URL = "http://localhost:30101";
+
+
# Frontend Config
+
PUBLIC_UI_CONFIG_DISABLED = true;
+
APP_NAME = "dishNet Auth";
+
SESSION_DURATION = 120;
+
EMAILS_VERIFIED = true;
+
ALLOW_OWN_ACCOUNT_EDIT = true;
+
DISABLE_ANIMATIONS = true;
+
SMTP_HOST = "mail.pyrox.dev";
+
SMTP_PORT = 465;
+
SMTP_FROM = "auth@pyrox.dev";
+
SMTP_USER = "auth@pyrox.dev";
+
SMTP_TLS = "tls";
+
SMTP_SKIP_CERT_VERIFY = false;
+
LDAP_ENABLED = false;
+
};
+
};
+
+
age.secrets.pocket-id-secrets = {
+
file = ./secrets/pocket-id-secrets.age;
+
owner = "pocket-id";
+
group = "pocket-id";
+
};
+
services.anubis.instances = {
+
pocket-id-fe = {
+
settings = {
+
BIND = ":${toString d.anubis}";
+
POLICY_FNAME = "${pkgs.py.anubis-files}/policies/pocket-id.yaml";
+
TARGET = "http://localhost:${toString d.port}";
+
};
+
};
+
pocket-id-be = {
+
settings = {
+
BIND = ":${toString d.be-anubis}";
+
POLICY_FNAME = "${pkgs.py.anubis-files}/policies/pocket-id.yaml";
+
TARGET = "http://localhost:${toString d.be-port}";
+
};
+
};
+
};
+
}
systems/x86_64-linux/marvin/services/secrets/pocket-id-secrets.age

This is a binary file and will not be displayed.

+1
systems/x86_64-linux/marvin/services/secrets/secrets.nix
···
"nix-serve-priv.age".publicKeys = marvinDefault;
"pinchflat-secrets.age".publicKeys = marvinDefault;
"planka-env.age".publicKeys = marvinDefault;
+
"pocket-id-secrets.age".publicKeys = marvinDefault;
"vaultwarden-vars.age".publicKeys = marvinDefault;
"vaultwarden-pgpass.age".publicKeys = marvinDefault;
"webmentiond-env.age".publicKeys = marvinDefault;
+7
systems/x86_64-linux/marvin/services/vaultwarden.nix
···
age.secrets.vaultwarden-pgpass = vaultwardenSecret // {
file = ./secrets/vaultwarden-pgpass.age;
};
+
services.anubis.instances.vaultwarden = {
+
settings = {
+
BIND = ":${toString d.anubis}";
+
POLICY_FNAME = "${pkgs.py.anubis-files}/policies/vaultwarden.yaml";
+
TARGET = "http://localhost:${toString d.port}";
+
};
+
};
}
+24 -25
systems/x86_64-linux/prefect/services/caddy.nix
···
{ pkgs, lib, ... }:
let
pns = lib.py.data.services;
-
marvin = lib.py.data.hosts.marvin.ts.ip4;
+
marvin = "http://${lib.py.data.hosts.marvin.ts.ip4}";
tsNet = lib.py.data.tsNet;
-
reverseProxyToMarvin = port: ts: {
-
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString port}
-
${if ts then "tailscale_auth" else ""}
-
'';
-
};
in
{
services.caddy = {
···
};
# Authentik
-
"${pns.authentik.extUrl}:443" = {
-
serverAliases = [ "${pns.authentik.extUrl}:80" ];
+
${pns.pocket-id.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.authentik.anubis} {
-
header_up X-Real-Ip {remote_host}
-
header_up X-Http-Version {http.request.proto}
-
}
+
reverse_proxy /api/* ${marvin}:${toString pns.pocket-id.be-port} {
+
header_up X-Real-IP {remote_host}
+
header_up X-Http-Version {http.request.proto}
+
}
+
reverse_proxy /.well-known/* ${marvin}:${toString pns.pocket-id.be-port} {
+
header_up X-Real-IP {remote_host}
+
header_up X-Http-Version {http.request.proto}
+
}
+
reverse_proxy /* ${marvin}:${toString pns.pocket-id.port} {
+
header_up X-Real-IP {remote_host}
+
header_up X-Http-Version {http.request.proto}
+
}
'';
};
-
"http://${pns.authentik.extUrl}:389" = reverseProxyToMarvin 389 false;
-
"${pns.authentik.extUrl}:636" = reverseProxyToMarvin 636 false;
# Vaultwarden
${pns.vaultwarden.extUrl} = {
···
${pns.matrix-server.extUrl} = {
extraConfig = ''
handle /_matrix/* {
-
reverse_proxy http://${marvin}:${toString pns.matrix-server.port}
+
reverse_proxy ${marvin}:${toString pns.matrix-server.port}
}
handle {
root * /var/www/cinny/dist/
···
${pns.jellyfin.extUrl} = {
extraConfig = ''
@blocked not remote_ip 100.64.0.0/10 private_ranges
-
reverse_proxy http://${marvin}:${toString pns.jellyfin.port}
+
reverse_proxy ${marvin}:${toString pns.jellyfin.port}
handle /metrics* {
respond @blocked "Access Denied" 403
}
···
# Forgejo
${pns.git.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.git.anubis} {
+
reverse_proxy ${marvin}:${toString pns.git.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
# Grafana
${pns.grafana.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.grafana.anubis} {
+
reverse_proxy ${marvin}:${toString pns.grafana.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
# Miniflux
${pns.miniflux.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.miniflux.anubis} {
+
reverse_proxy ${marvin}:${toString pns.miniflux.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
# Nextcloud
${pns.nextcloud.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.nextcloud.anubis} {
+
reverse_proxy ${marvin}:${toString pns.nextcloud.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
# Nextcloud-Office(Collabora)
${pns.nextcloud-office.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.nextcloud-office.anubis} {
+
reverse_proxy ${marvin}:${toString pns.nextcloud-office.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
# Planka
${pns.planka.extUrl} = {
extraConfig = ''
-
reverse_proxy http://${marvin}:${toString pns.planka.anubis} {
+
reverse_proxy ${marvin}:${toString pns.planka.anubis} {
header_up X-Real-Ip {remote_host}
header_up X-Http-Version {http.request.proto}
}
···
extraConfig = ''
bind tailscale/${pns.deemix.tsHost}
tailscale_auth
-
reverse_proxy http://${marvin}:${toString pns.deemix.port}
+
reverse_proxy ${marvin}:${toString pns.deemix.port}
'';
};
# Pinchflat
···
extraConfig = ''
bind tailscale/${pns.pinchflat.tsHost}
tailscale_auth
-
reverse_proxy http://${marvin}:${toString pns.pinchflat.port}
+
reverse_proxy ${marvin}:${toString pns.pinchflat.port}
'';
};