NixOS-Config/nixos/server/package-configs/cinny/default.nix

46 lines
891 B
Nix

{
config,
pkgs,
inputs,
lib,
...
}: let
port = 2143;
configFile =
pkgs.writeText "config.json"
''
{
"defaultHomeserver": 0,
"homeserverList": [
"matrix.gladtherescake.eu"
],
"allowCustomHomeservers": false
}
'';
in {
virtualisation.oci-containers.containers."cinny" = {
autoStart = true;
ports = ["${toString port}:80"];
volumes = [
"${configFile}:/app/config.json"
];
image = "ajbura/cinny:latest";
};
services.nginx = {
enable = true;
virtualHosts = {
"cinny.gladtherescake.eu" = {
## Force HTTP redirect to HTTPS
forceSSL = true;
## LetsEncrypt
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
proxyWebsockets = true;
};
};
};
};
}