From ea4a5a6d4129f4d68404099e8f5f256d363e1773 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 29 Feb 2024 11:36:25 -0600 Subject: [PATCH] Matrix container working --- hosts/myself/matrix.nix | 24 ++++++++++++++++++++++-- modules/nixos/db.nix | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/hosts/myself/matrix.nix b/hosts/myself/matrix.nix index f636219..4aaee73 100644 --- a/hosts/myself/matrix.nix +++ b/hosts/myself/matrix.nix @@ -5,9 +5,23 @@ let conn = "postgresql:///dendrite?sslmode=disable&host=/run/postgresql"; in { + systemd.services."container@matrix".serviceConfig = { + DeviceAllow = [ "/dev/net/tun" ]; + ProtectKernelModules = false; + PrivateDevices = false; + }; containers.matrix = { autoStart = true; - bindMounts."/etc/ssh".hostPath = "/etc/ssh"; + bindMounts = { + "/etc/ssh".hostPath = "/etc/ssh"; + "/dev/net/tun" = { + hostPath = "/dev/net/tun"; + isReadOnly = false; + }; + }; + hostAddress = "192.168.204.1"; + localAddress = "192.168.204.2"; + privateNetwork = true; config = { pkgs, config, ... }: { imports = [ inputs.agenix.nixosModules.default @@ -31,6 +45,10 @@ in file = ../../secrets/dendrite.age; owner = "dendrite"; }; + secrets.dendrite_key = { + file = ../../secrets/dendrite_key.age; + owner = "dendrite"; + }; }; users.users.dendrite = { @@ -48,6 +66,8 @@ in tailscale.enable = true; }; + #services.tailscale.interfaceName = "userspace-networking"; + services.dendrite = { enable = true; environmentFile = config.age.secrets.dendrite.path; @@ -83,7 +103,7 @@ in "jupiterbroadcasting.com" ]; # Generate this with {path-to-dendrite}/bin/generate-keys --private-key /etc/dendrite.pem - private_key = "/etc/dendrite.pem"; + private_key = config.age.secrets.dendrite_key.path; }; client_api = { registration_enabled = false; diff --git a/modules/nixos/db.nix b/modules/nixos/db.nix index 50c09e2..60c4d56 100644 --- a/modules/nixos/db.nix +++ b/modules/nixos/db.nix @@ -55,7 +55,7 @@ in { greg.backup.jobs.greg-postgresql-backup = { src = config.services.postgresqlBackup.location; - dest = "linode-postgres"; + dest = "database-${config.networking.hostName}"; user = "postgres"; }; };