summaryrefslogtreecommitdiff
path: root/hosts/cloud/irc.nix
diff options
context:
space:
mode:
authorGrisha Shipunov2026-08-01 14:55:50 +0000
committerGrisha Shipunov2026-08-01 15:22:29 +0000
commitd1f771dd9eeb680cbd7ffef5a8667dae5bbb4837 (patch)
treefdf0e87dd64a665ff5542353ab914bf55abb97c5 /hosts/cloud/irc.nix
parent05b195e8156dd16f573fee8fdbe1abb1343f9ce2 (diff)
reconfigure soju
Diffstat (limited to 'hosts/cloud/irc.nix')
-rw-r--r--hosts/cloud/irc.nix68
1 files changed, 65 insertions, 3 deletions
diff --git a/hosts/cloud/irc.nix b/hosts/cloud/irc.nix
index d39a2e9..18789e6 100644
--- a/hosts/cloud/irc.nix
+++ b/hosts/cloud/irc.nix
@@ -1,12 +1,74 @@
-{ pkgs, ... }:
+{ pkgs, config, lib, ... }:
+let
+ domain = "bnc.oxapentane.com";
+ certDir = config.security.acme.certs.${domain}.directory;
+in
{
+ # so soju can read the cert
+ users.groups.soju-tls = {};
+
+ sops.secrets = {
+ mythicbeasts-acme-bnc-api = {
+ owner = "root";
+ group = "root";
+ mode = "0400";
+ };
+ mythicbeasts-acme-bnc-api-secret = {
+ owner = "root";
+ group = "root";
+ mode = "0400";
+ };
+ };
+
+ # get the cert via DNS
+ security.acme = {
+ acceptTerms = true;
+ certs.${domain} = {
+ dnsProvider = "mythicbeasts";
+ credentialFiles = {
+ "MYTHICBEASTS_USERNAME_FILE" = config.sops.secrets.mythicbeasts-acme-bnc-api.path;
+ "MYTHICBEASTS_PASSWORD_FILE" = config.sops.secrets.mythicbeasts-acme-bnc-api-secret.path;
+ };
+ group = "soju-tls";
+ reloadServices = [
+ "soju.service"
+ ];
+ };
+ };
+
+ # open port
+ networking.firewall.allowedTCPPorts = [
+ 6697
+ ];
+
+ # soju config
services.soju = {
enable = true;
+ hostName = domain;
listen = [
- "irc+insecure://10.89.87.1"
- "irc+insecure://[fd31:185d:722e::1]"
+ "ircs://:6697"
];
+
+ tlsCertificate = "${certDir}/fullchain.pem";
+ tlsCertificateKey = "${certDir}/key.pem";
+
+ adminSocket.enable = true;
+ enableMessageLogging = true;
};
+ systemd.services.soju = {
+ wants = [ "acme-${domain}.service" ];
+ after = [ "acme-${domain}.service" ];
+ serviceConfig.SupplementaryGroups = [ "soju-tls" ];
+ };
+
+ # make sure that creds are there, before contacting letsencrypt
+ systemd.services."acme-order-renew-${domain}" =
+ lib.mkIf config.sops.useSystemdActivation
+ {
+ requires = [ "sops-install-secrets.service" ];
+ after = [ "sops-install-secrets.service" ];
+ };
+
environment.systemPackages = [ pkgs.soju ];
}