Skip to content

Commit 1824c24

Browse files
committed
lk-jwt-service: init
1 parent 53ff52f commit 1824c24

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

nixos/tests/all-tests.nix

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
system,
33
pkgs,
4-
54
# Projects the test configuration into a the desired value; usually
65
# the test runner: `config: config.test`.
76
callTest,
8-
97
}:
108
# The return value of this function will be an attrset with arbitrary depth and
119
# the `anything` returned by callTest at its test leaves.
@@ -14,9 +12,7 @@
1412
# where said tests are unsupported.
1513
# Example callTest that just extracts the derivation from the test:
1614
# callTest = t: t.test;
17-
1815
with pkgs.lib;
19-
2016
let
2117
discoverTests =
2218
val:
@@ -36,7 +32,8 @@ let
3632
else
3733
val;
3834

39-
/**
35+
/*
36+
*
4037
Evaluate a test and return a derivation that runs the test as its builder.
4138
4239
This function is deprecated in favor of runTest and runTestOn, which works
@@ -74,7 +71,8 @@ let
7471
*/
7572
handleTest = path: args: discoverTests (import path ({ inherit system pkgs; } // args));
7673

77-
/**
74+
/*
75+
*
7876
See handleTest
7977
*/
8078
handleTestOn =
@@ -113,11 +111,13 @@ let
113111
findTests r;
114112
runTestOn = systems: arg: if elem system systems then runTest arg else { };
115113
})
116-
/**
114+
/*
115+
*
117116
See https://nixos.org/manual/nixos/unstable/#sec-calling-nixos-tests
118117
*/
119118
runTest
120-
/**
119+
/*
120+
*
121121
See https://nixos.org/manual/nixos/unstable/#sec-calling-nixos-tests
122122
*/
123123
runTestOn
@@ -140,10 +140,8 @@ let
140140
_class = "nixosTest";
141141
node.pkgs = pkgs.pkgsLinux;
142142
};
143-
144143
in
145144
{
146-
147145
# Testing the test driver
148146
nixos-test-driver = {
149147
extra-python-packages = handleTest ./nixos-test-driver/extra-python-packages.nix { };
@@ -737,6 +735,7 @@ in
737735
listmonk = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./listmonk.nix { };
738736
litellm = runTest ./litellm.nix;
739737
litestream = handleTest ./litestream.nix { };
738+
lk-jwt-service = runTest ./matrix/lk-jwt-service.nix;
740739
lldap = handleTest ./lldap.nix { };
741740
localsend = handleTest ./localsend.nix { };
742741
locate = handleTest ./locate.nix { };

nixos/tests/matrix/lk-jwt-service.nix

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
pkgs,
3+
lib,
4+
...
5+
}:
6+
{
7+
name = "lk-jwt-service";
8+
meta.maintainers = [ lib.maintainers.quadradical ];
9+
10+
nodes.machine = {
11+
services.lk-jwt-service = {
12+
enable = true;
13+
keyFile = pkgs.writers.writeYAML "keys.yaml" {
14+
key = "f6lQGaHtM5HfgZjIcec3cOCRfiDqIine4CpZZnqdT5cE";
15+
};
16+
livekitUrl = "wss://127.0.0.1:8100";
17+
port = 8000;
18+
};
19+
};
20+
21+
testScript = ''
22+
machine.wait_for_unit("lk-jwt-service.service")
23+
machine.succeed("curl 127.0.0.1:8000/sfu/get")
24+
'';
25+
}

pkgs/by-name/lk/lk-jwt-service/package.nix

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
lib,
33
buildGoModule,
44
fetchFromGitHub,
5+
nixosTests,
56
}:
6-
77
buildGoModule (finalAttrs: {
88
pname = "lk-jwt-service";
99
version = "0.2.3";
@@ -17,6 +17,8 @@ buildGoModule (finalAttrs: {
1717

1818
vendorHash = "sha256-47eJO1Ai78RuhlEPn/J1cd+YSqvmfUD8cuPZIqsdxvI=";
1919

20+
passthru.tests = nixosTests.lk-jwt-service;
21+
2022
meta = with lib; {
2123
changelog = "https://github.com/element-hq/lk-jwt-service/releases/tag/${finalAttrs.src.tag}";
2224
description = "Minimal service to issue LiveKit JWTs for MatrixRTC";

0 commit comments

Comments
 (0)