Merge pull request 'Migrate heisenbridge from clanModule to clanService' (#3837) from migrate-heisenbridge into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3837
This commit is contained in:
@@ -47,6 +47,9 @@ in
|
||||
# Garage test
|
||||
garage = import ./garage nixosTestArgs;
|
||||
|
||||
# Heisenbridge test
|
||||
heisenbridge = import ./heisenbridge nixosTestArgs;
|
||||
|
||||
# Base Tests
|
||||
secrets = self.clanLib.test.baseTest ./secrets nixosTestArgs;
|
||||
borgbackup-legacy = self.clanLib.test.baseTest ./borgbackup-legacy nixosTestArgs;
|
||||
|
||||
65
checks/heisenbridge/default.nix
Normal file
65
checks/heisenbridge/default.nix
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
pkgs,
|
||||
nixosLib,
|
||||
clan-core,
|
||||
...
|
||||
}:
|
||||
|
||||
nixosLib.runTest (
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
clan-core.modules.nixosVmTest.clanTest
|
||||
];
|
||||
|
||||
hostPkgs = pkgs;
|
||||
|
||||
name = "heisenbridge";
|
||||
|
||||
clan = {
|
||||
directory = ./.;
|
||||
modules."@clan/heisenbridge" = ../../clanServices/heisenbridge/default.nix;
|
||||
inventory = {
|
||||
machines.server = { };
|
||||
|
||||
instances = {
|
||||
heisenbridge-test = {
|
||||
module.name = "@clan/heisenbridge";
|
||||
roles.default.machines."server".settings = {
|
||||
homeserver = "http://127.0.0.1:8008";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server = {
|
||||
# Setup a minimal matrix-synapse to test with
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings.server_name = "example.com";
|
||||
settings.database = {
|
||||
name = "sqlite3";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
server.wait_for_unit("matrix-synapse")
|
||||
server.wait_for_unit("heisenbridge")
|
||||
|
||||
# Check that heisenbridge is running
|
||||
server.succeed("systemctl status heisenbridge")
|
||||
|
||||
# Wait for the bridge to initialize
|
||||
server.wait_until_succeeds("journalctl -u heisenbridge | grep -q 'bridge is now running'")
|
||||
|
||||
# Check that heisenbridge is listening on the default port
|
||||
server.succeed("${pkgs.netcat}/bin/nc -z -v 127.0.0.1 9898")
|
||||
'';
|
||||
}
|
||||
)
|
||||
4
checks/heisenbridge/sops/users/admin/key.json
Normal file
4
checks/heisenbridge/sops/users/admin/key.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"publickey": "age1qm0p4vf9jvcnn43s6l4prk8zn6cx0ep9gzvevxecv729xz540v8qa742eg",
|
||||
"type": "age"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
description = "A matrix bridge to communicate with IRC"
|
||||
categories = ["Social"]
|
||||
features = [ "inventory", "deprecated" ]
|
||||
---
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
@@ -5,6 +5,7 @@
|
||||
./deltachat/flake-module.nix
|
||||
./ergochat/flake-module.nix
|
||||
./garage/flake-module.nix
|
||||
./heisenbridge/flake-module.nix
|
||||
./auto-upgrade/flake-module.nix
|
||||
./hello-world/flake-module.nix
|
||||
./wifi/flake-module.nix
|
||||
|
||||
35
clanServices/heisenbridge/default.nix
Normal file
35
clanServices/heisenbridge/default.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ ... }:
|
||||
{
|
||||
_class = "clan.service";
|
||||
manifest.name = "clan-core/heisenbridge";
|
||||
manifest.description = "A matrix bridge to communicate with IRC";
|
||||
manifest.categories = [ "Social" ];
|
||||
|
||||
roles.default = {
|
||||
interface =
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.homeserver = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "http://localhost:8008";
|
||||
description = "URL of the Matrix homeserver";
|
||||
};
|
||||
};
|
||||
|
||||
perInstance =
|
||||
{ settings, ... }:
|
||||
{
|
||||
nixosModule = {
|
||||
|
||||
services.heisenbridge = {
|
||||
enable = true;
|
||||
homeserver = settings.homeserver;
|
||||
};
|
||||
|
||||
services.matrix-synapse.settings.app_service_config_files = [
|
||||
"/var/lib/heisenbridge/registration.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
clanServices/heisenbridge/flake-module.nix
Normal file
6
clanServices/heisenbridge/flake-module.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
heisenbridge = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
}
|
||||
@@ -88,6 +88,7 @@ nav:
|
||||
- reference/clanServices/deltachat.md
|
||||
- reference/clanServices/ergochat.md
|
||||
- reference/clanServices/garage.md
|
||||
- reference/clanServices/heisenbridge.md
|
||||
- reference/clanServices/hello-world.md
|
||||
- reference/clanServices/wifi.md
|
||||
- Clan Modules:
|
||||
|
||||
Reference in New Issue
Block a user