Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
main 2022-09-22 15:17:34 +02:00
parent a27a4c4e78
commit 4b6de9e74d
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
6 changed files with 105 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{ nglib, nixpkgs }: { nglib, nixpkgs }:
nglib.makeSystem { nglib.makeSystem {
system = "x86_64-linux"; system = "x86_64-linux";
name = "nixng-gitea"; name = "synapse";
inherit nixpkgs; inherit nixpkgs;
config = ({ pkgs, ... }: config = ({ pkgs, ... }:
{ {

View file

@ -0,0 +1,40 @@
{ 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}
'';
};
});
}

View file

@ -1,7 +1,7 @@
{ nglib, nixpkgs }: { nglib, nixpkgs }:
nglib.makeSystem { nglib.makeSystem {
system = "x86_64-linux"; system = "x86_64-linux";
name = "nixng-gitea"; name = "mautrix-facebook";
inherit nixpkgs; inherit nixpkgs;
config = ({ pkgs, ... }: config = ({ pkgs, ... }:
{ {

View file

@ -48,6 +48,7 @@
baikal = import ./containers/baikal.nix base; baikal = import ./containers/baikal.nix base;
conduit = import ./containers/conduit.nix base; conduit = import ./containers/conduit.nix base;
mautrix-facebook = import ./containers/mautrix-facebook.nix base; mautrix-facebook = import ./containers/mautrix-facebook.nix base;
heisenbridge = import ./containers/heisenbridge.nix base;
}; };
hydraJobs = hydraJobs =

View file

@ -95,8 +95,60 @@ EOF
} }
resources { resources {
cpu = 500 cpu = 256
memory = 1024 memory = 256
}
}
}
group "heisenbridge" {
count = 1
volume "matrix-registrations" {
type = "csi"
source = "matrix-registrations"
read_only = false
attachment_mode = "file-system"
access_mode = "multi-node-multi-writer"
}
restart {
attempts = 5
delay = "5s"
}
network {
mode = "bridge"
}
service {
name = "matrix-heisenbridge"
port = "9898"
connect {
sidecar_service {}
}
}
task "heisenbridge" {
driver = "containerd-driver"
volume_mount {
volume = "matrix-registrations"
destination = "/var/lib/registrations"
read_only = false
}
config {
flake_ref = "${var.flake_ref}#nixngSystems.registrations.config.system.build.toplevel"
flake_sha = var.flake_sha
entrypoint = [ "init" ]
}
resources {
cpu = 128
memory = 128
} }
} }
} }
@ -151,6 +203,11 @@ EOF
destination_name = "matrix-mautrix-facebook" destination_name = "matrix-mautrix-facebook"
local_bind_port = 29319 local_bind_port = 29319
} }
upstreams {
destination_name = "matrix-heisenbridge"
local_bind_port = 9898
}
} }
} }
} }
@ -179,7 +236,7 @@ EOF
resources { resources {
cpu = 2048 cpu = 2048
memory = 4096 memory = 2048
} }
vault { vault {

View file

@ -1,6 +1,6 @@
flake_rev = "e7216e601a70f595893971d8b6f2296f3e867269" flake_rev = "a27a4c4e78928564383e165b3868aa4f63c451df"
flake_ref = "conduit-wip" flake_ref = "conduit-wip"
flake_host = "git+https://git.sr.ht/~magic_rb/cluster" flake_host = "git+https://git.sr.ht/~magic_rb/cluster"
flake_host_alt = "git+https://git.sr.ht/~magic_rb/cluster" flake_host_alt = "git+https://git.sr.ht/~magic_rb/cluster"
flake_sha = "sha256-RJDAmsZJjBVvbYBG1vP5Se+i3n2IO3E2Y5fWFFmQ7lQ=" flake_sha = "sha256-7b/9W8mDnqQv0DfH6if0IVbMWR8iEvor7Ktth/WkX9M="