Tons o' stuff

This commit is contained in:
2024-03-23 14:23:43 -07:00
parent cf10f910bd
commit 8b10f47699
17 changed files with 259 additions and 146 deletions
+1
View File
@@ -76,6 +76,7 @@ in {
matrixServerName = matrixHostname;
openIdClientId = readFile domainSecrets."matrix-oidc.clientid";
openIdClientSecret = readFile domainSecrets."matrix-oidc.secret";
openIdJwtSecret = readFile domainSecrets."matrix-private.pem";
})
(import ./fudo.org/mail-server.nix (rec {
primaryMailserver = "germany";
@@ -10,6 +10,7 @@ let
zoneName = config.fudo.domains."${domainName}".zone;
isAuthentik = hostname == authentikHost;
authentikHostname = "authentik.${domainName}";
in {
config = {
fudo = {
@@ -20,6 +21,8 @@ in {
zones."${zoneName}".aliases.authentik = authentikHost;
};
systemd.services.authentik-cert-copy.after = [ "fudo-secrets.target" ];
services = {
authentikContainer = mkIf isAuthentik {
enable = true;
@@ -78,6 +78,7 @@ in {
trusted-networks = config.instance.local-networks;
smtp = {
hostname = "mail.${primaryDomain}";
spf.enable = false;
ssl-directory =
config.security.acme.certs."mail.${primaryDomain}".directory;
};
+7 -1
View File
@@ -1,4 +1,5 @@
{ matrixHost, matrixServerName, openIdClientId, openIdClientSecret, ... }:
{ matrixHost, matrixServerName, openIdClientId, openIdClientSecret
, openIdJwtSecret, ... }:
{ config, lib, pkgs, ... }:
@@ -29,6 +30,7 @@ in {
provider = "fudo-auth";
provider-name = "Fudo Auth";
issuer = "https://authentik.fudo.org/application/o/matrix/";
jwt-secret = openIdJwtSecret;
};
};
};
@@ -73,6 +75,10 @@ in {
"/.well-known/matrix/client".extraConfig = mkWellKnown {
"m.homeserver".base_url = "https://${matrixFqdn}:443";
};
"/.well-known/matrix/openid".extraConfig = mkWellKnown {
"token-issuer" = "https://authentik.fudo.org/application/o/token/";
"client-id" = openIdClientId;
};
"/.well-known/acme-challenge" = {
root = "/var/lib/acme/acme-challenge/";
extraConfig = "auth_basic off;";
+8
View File
@@ -7,6 +7,7 @@ let
primaryNameserver = "locum";
defaultHost = "locum";
authentikHost = "locum";
lemmyHost = "locum";
userdbPasswd = pkgs.lib.passwd.stablerandom-passwd-file "userdb-passwd"
config.instance.build-seed;
@@ -74,6 +75,13 @@ in {
reverse-zones = [ "172.86.179.17/29" "190.2.134.0/24" ];
};
};
lemmy = {
enable = hostname == lemmyHost;
hostname = "informis.land";
site-name = "Informis";
smtp.host = "mail.informis.land";
};
};
postgresql.package = pkgs.postgresql_15_gssapi;
+7 -5
View File
@@ -17,12 +17,9 @@ let
immichHost = "toothless";
in {
imports = [ ./sea.fudo.org/8bitdo.nix ];
config = {
fudo.zones."sea.fudo.org".aliases = {
chat = "nostromo";
frigate = "zbox";
immich = immichHost;
};
fudo = {
services = {
metrics = {
@@ -42,6 +39,11 @@ in {
acl = [ "frigate/#" ];
};
};
zones."sea.fudo.org".aliases = {
chat = "nostromo";
frigate = "zbox";
immich = immichHost;
};
};
services = {
@@ -0,0 +1,83 @@
{ config, lib, pkgs, ... }:
with lib;
let
hostname = config.instance.hostname;
enable-gui = config.fudo.hosts."${hostname}".enable-gui;
# 70:9C:D1:0E:48:AD
in {
config = mkIf enable-gui {
environment.systemPackages = with pkgs; [ xboxdrv ];
services.udev.extraRules = let
# btStartScript = concatStringsSep "," [
# ''SUBSYSTEM=="input"''
# ''ATTR{PHYS}=="70:9c:d1:0e:48:ad"''
# ''ATTR{ACTION}=="add"''
# ''ATTR{PRODUCT}=="5/57e/2009/8001"''
# ''
# RUN+="${pkgs.systemd}/bin/systemctl start controller-8bitdo-ultimate-xinput@70_9C_D1_0E_48_AD"''
# ];
# btStopScript = concatStringsSep "," [
# ''SUBSYSTEM=="input"''
# ''ATTR{PHYS}=="70:9c:d1:0e:48:ad"''
# ''ATTR{ACTION}=="remove"''
# ''ATTR{PRODUCT}=="5/57e/2009/8001"''
# ''
# RUN+="${pkgs.systemd}/bin/systemctl stop controller-8bitdo-ultimate-xinput@70_9C_D1_0E_48_AD"''
# ];
# usbStartScript = concatStringsSep "," [
# ''SUBSYSTEM=="usb"''
# ''ATTR{idVendor}=="2dc8"''
# ''ATTR{idProduct}=="3106"''
# ''ATTR{manufacturer}=="8BitDo"''
# ''
# RUN+="${pkgs.systemd}/bin/systemctl start controller-8bitdo-ultimate-xinput@2dc8:3106"''
# ];
# usbStopScript = concatStringsSep "," [
# ''SUBSYSTEM=="usb"''
# ''ATTR{idVendor}=="2dc8"''
# ''ATTR{idProduct}=="3016"'' # NOTE: 3106 - connect, 3016 - disconnect
# ''ATTR{manufacturer}=="8BitDo"''
# ''
# RUN+="${pkgs.systemd}/bin/systemctl stop controller-8bitdo-ultimate-xinput@2dc8:3106''
# ];
startScript = concatStringsSep "," [
''SUBSYSTEM=="input"''
''ACTION=="add"''
''ATTR{PRODUCT}=="5/57e/2009/8001"''
''
RUN+="${pkgs.systemd}/bin/systemctl start controller-8bitdo-ultimate-xinput@$env{ID_MODEL}"''
];
stopScript = concatStringsSep "," [
''SUBSYSTEM=="input"''
''ACTION=="remove"''
''ATTR{PRODUCT}=="5/57e/2009/8001"''
''
RUN+="${pkgs.systemd}/bin/systemctl stop controller-8bitdo-ultimate-xinput@$env{ID_MODEL}"''
];
in concatStringsSep "\n" [ startScript stopScript ];
systemd.services."controller-8bitDo-ultimate-xinput@" = {
unitConfig.Dsecription =
"8BitDo Ultimate Controller XInput mode xboxdrv daemon";
serviceConfig = {
Type = "simple";
ExecStart =
pkgs.writeShellScript "controller-8bitDo-ultimate-xinput.sh" ''
echo "starting xboxdrv for $ID_MODEL"
${pkgs.xboxdrv}/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback;
'';
};
};
};
}
+5
View File
@@ -48,6 +48,11 @@ in {
requires = [ "fudo-secrets.target" ];
};
"lemmy" = {
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
};
fudo-mail-sync = {
path = with pkgs; [ rsync openssh ];
serviceConfig = {
+6 -8
View File
@@ -16,11 +16,6 @@ in {
"d ${stateDir}/lib/flatpak 755 root root - -"
];
# i18n.inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [ fcitx5-chinese-addons fcitx5-rime ];
# };
services.xserver = {
layout = "us";
xkbVariant = mkForce "";
@@ -47,9 +42,12 @@ in {
antialias = true;
};
environment.etc = {
nixos.source = "/etc/nixos-live";
NIXOS.source = "${stateDir}/etc/NIXOS";
environment = {
etc = {
nixos.source = "/etc/nixos-live";
NIXOS.source = "${stateDir}/etc/NIXOS";
};
systemPackages = with pkgs; [ bluez-tools ];
};
systemd.targets = {
+14 -12
View File
@@ -71,6 +71,8 @@ in {
mail.state-directory = "/state/services/mail";
postgresql.state-directory = "/state/services/postgresql";
services = {
authoritative-dns.state-directory = "/state/services/dns";
auth = {
@@ -89,18 +91,18 @@ in {
services = {
authentikContainer.state-directory = "/state/services/authentik";
lemmyDocker = {
enable = true;
hostname = "informis.land";
site-name = "Informis Lemmy";
version = "0.18.2";
state-directory = "/state/services/lemmy";
smtp-server = "smtp.informis.land:587";
docker-images = {
pictrs = "asonix/pictrs:0.4.0-rc.14";
postgres = "postgres:15-alpine";
};
};
# lemmyDocker = {
# enable = true;
# hostname = "informis.land";
# site-name = "Informis Lemmy";
# version = "0.18.2";
# state-directory = "/state/services/lemmy";
# smtp-server = "smtp.informis.land:587";
# docker-images = {
# pictrs = "asonix/pictrs:0.4.0-rc.14";
# postgres = "postgres:15-alpine";
# };
# };
nginx = {
enable = true;
+7 -4
View File
@@ -103,7 +103,7 @@ in {
];
services = {
blueman.enable = true;
blueman.enable = false;
openssh.hostKeys = [
{
@@ -134,9 +134,12 @@ in {
antialias = true;
};
environment.etc = {
nixos.source = "/etc/nixos-live";
NIXOS.source = "${state-dir}/etc/NIXOS";
environment = {
etc = {
nixos.source = "/etc/nixos-live";
NIXOS.source = "${state-dir}/etc/NIXOS";
};
systemPackages = with pkgs; [ bluez-tools ];
};
hardware = {
+1 -1
View File
@@ -3,7 +3,7 @@
with lib;
let
hostname = config.instance.hostname;
enable-gui = config.fudo.hosts.${hostname}.enable-gui;
enable-gui = config.fudo.hosts."${hostname}".enable-gui;
in {
imports = [ ./common.nix ];
+1 -1
View File
@@ -112,7 +112,7 @@ let
listen-ips = getHostIps hostname;
state-directory = "/var/lib/nsd";
state-directory = cfg.state-directory;
timestamp = toString config.instance.build-timestamp;
+1 -1
View File
@@ -49,7 +49,7 @@ in {
lemmyDbUrl = {
source-file = let
url =
"postgres:///lemmy?user=lemmy&password=${lemmyDbPasswd}&host=/var/run/postgresql";
"postgres:///lemmy?user=lemmy&password=${lemmyDbPasswd}&host=localhost&port=5432";
in pkgs.writeText "lemmy-db.url" url;
target-file = "/run/lemmy/db.url";
};
+3 -2
View File
@@ -204,8 +204,9 @@ in {
source-file =
pkgs.lib.passwd.stablerandom-passwd-file "nexus-server-passwd"
"nexus-server-${config.instance.build-seed}";
target-file = "/run/nexus/server-db.passwd";
user = "postgres";
target-file = "/run/nexus-postgres/server-db.passwd";
user = config.systemd.services.postgresql.serviceConfig.User;
group = config.systemd.services.postgresql.serviceConfig.Group;
};
nexus-dns-server-passwd = mkIf isDnsServer {