2024-03-02 22:05:30 +01:00
|
|
|
{inputs, ...}: {
|
2023-06-13 23:05:35 +02:00
|
|
|
flake.nixngConfigurations.heisenbridge = inputs.nixng.nglib.makeSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
name = "heisenbridge";
|
2024-07-03 17:39:49 +02:00
|
|
|
nixpkgs = inputs.nixpkgs-stable;
|
2024-03-02 22:05:30 +01:00
|
|
|
config = {
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit
|
|
|
|
(lib)
|
|
|
|
getExe'
|
|
|
|
;
|
|
|
|
in {
|
|
|
|
dumb-init = {
|
|
|
|
enable = true;
|
|
|
|
type.services = {};
|
|
|
|
};
|
2023-06-13 23:05:35 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
init.services.heisenbridge = {
|
|
|
|
enabled = true;
|
|
|
|
# heisenbridge needs to retry the connection and task restarting does not work currently
|
|
|
|
shutdownOnExit = false;
|
|
|
|
script = pkgs.writeShellScript "heisenbridge" ''
|
|
|
|
REGISTRATION_FILE="/var/lib/registrations/heisenbridge.yaml"
|
2023-06-13 23:05:35 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
${getExe' pkgs.heisenbridge "heisenbridge"} 'https://matrix.redalder.org/' \
|
|
|
|
-c "$REGISTRATION_FILE" \
|
|
|
|
$([ -e "$REGISTRATION_FILE" ] || echo "--generate") \
|
|
|
|
-l 127.0.0.1 \
|
|
|
|
-p 9898 \
|
|
|
|
-o @magic_rb:matrix.redalder.org
|
|
|
|
'';
|
2023-06-13 23:05:35 +02:00
|
|
|
};
|
2024-03-02 22:05:30 +01:00
|
|
|
};
|
2023-06-13 23:05:35 +02:00
|
|
|
};
|
|
|
|
}
|