2022-09-22 15:17:34 +02:00
|
|
|
{ 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;
|
|
|
|
shutdownOnExit = true;
|
|
|
|
script =
|
|
|
|
let
|
|
|
|
config =
|
|
|
|
''
|
|
|
|
-l 127.0.0.1 \
|
|
|
|
-p 9898 \
|
|
|
|
-o @magic_rb:matrix.redalder.org \
|
|
|
|
'';
|
2022-09-22 15:32:03 +02:00
|
|
|
homeserverURI = "https://matrix.redalder.org/";
|
2022-09-22 15:17:34 +02:00
|
|
|
in
|
|
|
|
pkgs.writeShellScript "heisenbridge"
|
|
|
|
''
|
|
|
|
REGISTRATION_FILE="/var/lib/registrations/heisenbridge.yaml"
|
|
|
|
|
|
|
|
[ -e "$REGISTRATION_FILE" ] || \
|
2022-09-22 15:32:03 +02:00
|
|
|
${pkgs.heisenbridge}/bin/heisenbridge '${homeserverURI}' \
|
2022-09-22 15:17:34 +02:00
|
|
|
-c "$REGISTRATION_FILE" \
|
|
|
|
${config} \
|
|
|
|
--generate
|
2022-09-22 15:32:03 +02:00
|
|
|
${pkgs.heisenbridge}/bin/heisenbridge '${homeserverURI}' \
|
2022-09-22 15:17:34 +02:00
|
|
|
-c "$REGISTRATION_FILE" \
|
|
|
|
${config}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|