cluster/containers/heisenbridge.nix
main 8b974684b5
wip
Signed-off-by: main <magic_rb@redalder.org>
2022-09-22 15:41:00 +02:00

43 lines
1.2 KiB
Nix

{ nglib, nixpkgs }:
nglib.makeSystem {
system = "x86_64-linux";
name = "heisenbridge";
inherit nixpkgs;
config = ({ pkgs, ... }:
{
dumb-init = {
enable = true;
type.services = { };
};
init.services.heisenbridge = {
enabled = true;
# heisenbridge needs to retry the connection and task restarting does not work currently
shutdownOnExit = false;
script =
let
config =
''
-l 127.0.0.1 \
-p 9898 \
-o @magic_rb:matrix.redalder.org \
'';
homeserverURI = "https://matrix.redalder.org/";
in
pkgs.writeShellScript "heisenbridge"
''
REGISTRATION_FILE="/var/lib/registrations/heisenbridge.yaml"
[ -e "$REGISTRATION_FILE" ] || \
${pkgs.heisenbridge}/bin/heisenbridge '${homeserverURI}' \
-c "$REGISTRATION_FILE" \
${config} \
--generate
${pkgs.heisenbridge}/bin/heisenbridge '${homeserverURI}' \
-c "$REGISTRATION_FILE" \
${config}
'';
};
});
}