blob: f66a95b47a1d358c0f6656b7b9738b6cd5081f88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{ lib, ... }:
{
name = "reposilite";
nodes = {
machine =
{ pkgs, ... }:
{
services = {
mysql = {
enable = true;
package = pkgs.mariadb;
ensureDatabases = [ "reposilite" ];
initialScript = pkgs.writeText "reposilite-test-db-init" ''
CREATE USER 'reposilite'@'localhost' IDENTIFIED BY 'ReposiliteDBPass';
GRANT ALL PRIVILEGES ON reposilite.* TO 'reposilite'@'localhost';
FLUSH PRIVILEGES;
'';
};
reposilite = {
enable = true;
plugins = with pkgs.reposilitePlugins; [
checksum
groovy
];
extraArgs = [
"--token"
"test:SuperSecretTestToken"
];
database = {
type = "mariadb";
passwordFile = "/run/reposiliteDbPass";
};
settings.port = 8080;
};
};
};
};
testScript = ''
machine.start()
machine.execute("echo \"ReposiliteDBPass\" > /run/reposiliteDbPass && chmod 600 /run/reposiliteDbPass && chown reposilite:reposilite /run/reposiliteDbPass")
machine.wait_for_unit("reposilite.service")
machine.wait_for_open_port(8080)
machine.fail("curl -Sf localhost:8080/api/auth/me")
machine.succeed("curl -Sfu test:SuperSecretTestToken localhost:8080/api/auth/me")
'';
meta.maintainers = [ lib.maintainers.uku3lig ];
}
|