|
34 | 34 | }) |
35 | 35 | ]; |
36 | 36 | pkgs = import nixpkgs { inherit config overlays system; }; |
37 | | - dendriteHome = "/tmp/dendrite-home"; |
| 37 | + conduitHome = "/tmp/conduit-home"; |
38 | 38 |
|
39 | | - # A script to start a local matrix server with dendrite |
40 | | - dendriteStart = pkgs.writeScriptBin "dendrite-start" '' |
| 39 | + conduitConfig = pkgs.writeTextFile { |
| 40 | + name = "conduit.toml"; |
| 41 | + text = '' |
| 42 | + [global] |
| 43 | + server_name = "localhost" |
| 44 | + database_path = "${conduitHome}" |
| 45 | + database_backend = "rocksdb" |
| 46 | + port = 6167 |
| 47 | + max_request_size = 20_000_000 |
| 48 | + allow_registration = true |
| 49 | + allow_federation = false |
| 50 | + trusted_servers = [] |
| 51 | + #log = "info,state_res=warn,rocket=off,_=off,sled=off" |
| 52 | + address = "127.0.0.1" |
| 53 | + ''; |
| 54 | + }; |
| 55 | + |
| 56 | + # A script to start a local matrix server with conduit |
| 57 | + conduitStart = pkgs.writeScriptBin "conduit-start" '' |
41 | 58 | #!/bin/sh -e |
42 | | - mkdir -p ${dendriteHome} |
43 | | - cd ${dendriteHome} |
44 | | - if ! test -f dendrite.yaml; then |
45 | | - ${pkgs.dendrite}/bin/generate-config > dendrite.yaml |
46 | | - sed -e 's|/var/log/dendrite|${dendriteHome}/logs|' -i dendrite.yaml |
47 | | - fi |
48 | | - if ! test -f matrix_key.pem; then |
49 | | - ${pkgs.dendrite}/bin/generate-keys -private-key matrix_key.pem -tls-cert test.crt -tls-key test.key |
50 | | - fi |
51 | | - ${pkgs.dendrite}/bin/dendrite-monolith-server |
| 59 | + mkdir -p ${conduitHome} |
| 60 | + exec env CONDUIT_CONFIG=${conduitConfig} ${pkgs.matrix-conduit}/bin/conduit |
52 | 61 | ''; |
53 | 62 |
|
54 | 63 | # A script to setup test environment |
55 | | - dendriteSetup = pkgs.writeScriptBin "dendrite-setup" '' |
| 64 | + conduitSetup = pkgs.writeScriptBin "conduit-setup" '' |
56 | 65 | #!/bin/sh -e |
57 | | - cd ${dendriteHome} |
58 | | - HOMESERVER_URL=http://localhost:8008 |
| 66 | + HOMESERVER_URL=http://localhost:6167 |
| 67 | + export PATH=$PATH:${pkgs.jq}/bin:${pkgs.curl}/bin |
59 | 68 | create_token () { |
60 | | - ${pkgs.dendrite}/bin/create-account -username $1 -password $2 || true |
61 | | - ${pkgs.curl}/bin/curl -XPOST $HOMESERVER_URL/_matrix/client/r0/login -d '{"user": "'$1'", "password": "'$2'", "type": "m.login.password"}' | ${pkgs.jq}/bin/jq -r ".access_token" |
| 69 | + REGISTER_TOKEN=$(curl -XPOST $HOMESERVER_URL/_matrix/client/v3/register -d '{"auth":{"type": "m.login.dummy"}, "username": "'$1'", "password": "'$2'"}' | jq -r ".access_token") |
| 70 | + if [ "$REGISTER_TOKEN" != "null" ]; then |
| 71 | + echo $REGISTER_TOKEN |
| 72 | + else |
| 73 | + curl -XPOST $HOMESERVER_URL/_matrix/client/v3/login -d '{"type": "m.login.password", "identifier": {"type": "m.id.user", "user": "'$1'"}, "password": "'$2'"}' | jq -r ".access_token" |
| 74 | + fi |
62 | 75 | } |
63 | 76 | echo HOMESERVER_URL=$HOMESERVER_URL |
64 | 77 | echo PRIMARY_TOKEN=$(create_token "test-user" "test-pass") |
|
88 | 101 | pkgs.haskell-language-server |
89 | 102 | pkgs.ghcid |
90 | 103 | testScript |
91 | | - dendriteStart |
92 | | - dendriteSetup |
| 104 | + conduitStart |
| 105 | + conduitSetup |
93 | 106 | ]; |
94 | 107 |
|
95 | 108 | withHoogle = false; |
|
0 commit comments