added matrix server :D
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
containerSilverbullet
|
||||
containerPaperless
|
||||
containerWarpgate
|
||||
containerMatrix
|
||||
];
|
||||
in {
|
||||
imports = modules;
|
||||
|
||||
128
modules/containers/matrix/container.nix
Normal file
128
modules/containers/matrix/container.nix
Normal file
@@ -0,0 +1,128 @@
|
||||
{moduleWithSystem, ...}: {
|
||||
flake.nixosModules.containerMatrix = moduleWithSystem ({pkgs, ...}: {config, ...}: {
|
||||
virtualisation.oci-containers.containers."matrix-mjolnir" = {
|
||||
image = "matrixdotorg/mjolnir:latest";
|
||||
volumes = [
|
||||
"/containers/synapse/mjolnir:/data:rw"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=mjolnir"
|
||||
"--network=matrix_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-matrix-mjolnir" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
};
|
||||
virtualisation.oci-containers.containers."synapse" = {
|
||||
image = "matrixdotorg/synapse:latest";
|
||||
environment = {
|
||||
"SYNAPSE_CONFIG_PATH" = "/data/homeserver.yaml";
|
||||
};
|
||||
volumes = [
|
||||
"/containers/synapse/synapse-data:/data:rw"
|
||||
];
|
||||
ports = [
|
||||
"8008:8008/tcp"
|
||||
];
|
||||
dependsOn = [
|
||||
"synapse-db"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=synapse"
|
||||
"--network=matrix_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-synapse" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
};
|
||||
virtualisation.oci-containers.containers."synapse-db" = {
|
||||
image = "postgres:15-alpine";
|
||||
environment = {
|
||||
"POSTGRES_DB" = "synapse";
|
||||
"POSTGRES_INITDB_ARGS" = "--encoding=UTF8 --locale=C";
|
||||
"POSTGRES_USER" = "synapse";
|
||||
};
|
||||
environmentFiles = [config.sops.templates."matrix.env".path];
|
||||
volumes = [
|
||||
"/containers/synapse/postgres-data:/var/lib/postgresql/data:rw"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=postgres"
|
||||
"--network=matrix_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-synapse-db" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-matrix_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-matrix-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-matrix_default" = {
|
||||
path = [pkgs.podman];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f matrix_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect matrix_default || podman network create matrix_default
|
||||
'';
|
||||
partOf = ["podman-compose-matrix-root.target"];
|
||||
wantedBy = ["podman-compose-matrix-root.target"];
|
||||
};
|
||||
|
||||
# Root service
|
||||
# When started, this will automatically create all resources and start
|
||||
# the containers. When stopped, this will teardown all resources.
|
||||
systemd.targets."podman-compose-matrix-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
silverbullet-user = {};
|
||||
paperless-ngx-key = {};
|
||||
paperless-postgres-password = {};
|
||||
matrix-postgres-password = {};
|
||||
};
|
||||
templates = {
|
||||
"gitea.env".content = ''
|
||||
@@ -49,6 +50,9 @@
|
||||
POSTGRES_PASSWORD=${config.sops.placeholder.paperless-postgres-password}
|
||||
PAPERLESS_SECRET_KEY=${config.sops.placeholder.paperless-ngx-key}
|
||||
'';
|
||||
"matrix.env".content = ''
|
||||
"POSTGRES_PASSWORD" = ${config.sops.placeholder.matrix-postgres-password}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ mail-relay-passwd: ENC[AES256_GCM,data:9+2KuS27qukbedmG4fLwyw==,iv:+x5EgbJw/fha9
|
||||
silverbullet-user: ENC[AES256_GCM,data:8eoTT+T1+/khV7A96h3KoA==,iv:5wRlIU8hdRnseI5b3WUUZ0KOYtLdyrcON/P+yxg0LCs=,tag:Xxiae5Yrhv2gzIpUPX3PAw==,type:str]
|
||||
paperless-ngx-key: ENC[AES256_GCM,data:LxOcEwW4KXHHVM7rQ+qyFyZJX/uuIc5Fc0NDFF7k7qycNcGB1jYq90gAKnz3yf2DnN2FFQQfwc/nS3Z6s+z1bZqFtR6mGdOFQSzu4ALV3CUvY6im518=,iv:cuAGN8L1Rd44WIPCCwj+7W1b110tqG+kftyq9aHwc04=,tag:j3UE1hVAUu4Ch3FZAXdTKA==,type:str]
|
||||
paperless-postgres-password: ENC[AES256_GCM,data:lVPWNWuCUx1Q,iv:m8h1xiNoTg5w4lJ6Lv66EEzj5UxvVkEjv9DYG3KkcKw=,tag:QjggXhCCFZ9jrydUmwl3Ng==,type:str]
|
||||
matrix-postgres-password: ENC[AES256_GCM,data:TQfbzA/YKCsFKw634m9SeuHiiUHrogkBuhI=,iv:92poaFU7yWLo/U1DKMmoqVP1pjwTBp++Aqqd7tUv3Hs=,tag:olI2c+ISUlmWMICxLGfYJA==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -22,7 +23,7 @@ sops:
|
||||
XS8/g9qFT4nSgM/8nLhx7I4j5/NQU+CuB/iiG5Zs4iY6+vvAe0jIUg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1rg4rsns375z2zj4tv8cyqtjl504fw8tprlmj2w057dz6ztttjstsgjvkvy
|
||||
lastmodified: "2026-09-23T09:47:48Z"
|
||||
mac: ENC[AES256_GCM,data:M+lBXxSo3WrPGErRGK3xi9jR2Wxkd3OWf+H7xI5BTdT6AOvogwTX2HfhGvTff6HUZDdsZFWNEVWRFkeWJZ3jkK8TVOOf4R0EskcFIn/xANSfBdAVBvh4lc9yVgw0Xh3Z55NVeimMB2FL91wOFP5/vPlIMGZjfrkKeBLZtHKLpPU=,iv:6iWxAdgxZXkJkxdvRlKzN6DF0LZ1j60tKCU0wO5rUdo=,tag:vKe+MTLQBbvxn/PQ7Kw7mQ==,type:str]
|
||||
lastmodified: "2026-10-02T18:20:27Z"
|
||||
mac: ENC[AES256_GCM,data:P+f2bGyWVSiRlMXzlqdENNA0bI1ShM1WK+S82RZc2fcb8R+oZ3SmVnZDHQ76WEa/AAGX6DjkrwYGOB3uBvOWkJlnz+akhG7B7prn1gxH8KlfkBnVMuCwbl7gOSTGV82yS88rD5fT5p0qprLh60EnyI61NckYj7+cMeFdIF8JMJA=,iv:Ib70zrw8WBXzeGC6KjY3p59b1MIOMxy3Bkrd63SYWGY=,tag:yn4uFr12Gn/ObU5xCcxyoQ==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
|
||||
Reference in New Issue
Block a user