mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 16:04:25 +01:00
41 lines
1 KiB
Nix
41 lines
1 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;
|
||
|
shutdownOnExit = true;
|
||
|
script =
|
||
|
let
|
||
|
config =
|
||
|
''
|
||
|
-l 127.0.0.1 \
|
||
|
-p 9898 \
|
||
|
-o @magic_rb:matrix.redalder.org \
|
||
|
'';
|
||
|
in
|
||
|
pkgs.writeShellScript "heisenbridge"
|
||
|
''
|
||
|
REGISTRATION_FILE="/var/lib/registrations/heisenbridge.yaml"
|
||
|
|
||
|
[ -e "$REGISTRATION_FILE" ] || \
|
||
|
${pkgs.heisenbridge}/bin/heisenbridge \
|
||
|
-c "$REGISTRATION_FILE" \
|
||
|
${config} \
|
||
|
--generate
|
||
|
${pkgs.heisenbridge}/bin/heisenbridge \
|
||
|
-c "$REGISTRATION_FILE" \
|
||
|
${config}
|
||
|
'';
|
||
|
};
|
||
|
});
|
||
|
}
|