|
6 | 6 | nixConfig.bash-prompt = "[nix]λ "; |
7 | 7 |
|
8 | 8 | inputs = { |
9 | | - nixpkgs.url = "github:NixOS/nixpkgs"; |
| 9 | + nixpkgs.url = |
| 10 | + "github:NixOS/nixpkgs/00d73d5385b63e868bd11282fb775f6fe4921fb5"; |
10 | 11 | flake-utils.url = "github:numtide/flake-utils"; |
11 | 12 | }; |
12 | 13 |
|
13 | 14 | outputs = { self, nixpkgs, flake-utils }: |
14 | 15 | flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: |
15 | 16 | let |
16 | 17 | config = { }; |
17 | | - compilerVersion = "8107"; |
| 18 | + compilerVersion = "924"; |
18 | 19 | compiler = "ghc" + compilerVersion; |
19 | 20 | overlays = [ |
20 | 21 | (final: prev: { |
|
33 | 34 | }) |
34 | 35 | ]; |
35 | 36 | pkgs = import nixpkgs { inherit config overlays system; }; |
36 | | - dendriteHome = "/tmp/dendrite-home"; |
| 37 | + conduitHome = "/tmp/conduit-home"; |
37 | 38 |
|
38 | | - # A script to start a local matrix server with dendrite |
39 | | - 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" '' |
40 | 58 | #!/bin/sh -e |
41 | | - mkdir -p ${dendriteHome} |
42 | | - cd ${dendriteHome} |
43 | | - if ! test -f dendrite.yaml; then |
44 | | - ${pkgs.dendrite}/bin/generate-config > dendrite.yaml |
45 | | - sed -e 's|/var/log/dendrite|${dendriteHome}/logs|' -i dendrite.yaml |
46 | | - fi |
47 | | - if ! test -f matrix_key.pem; then |
48 | | - ${pkgs.dendrite}/bin/generate-keys -private-key matrix_key.pem -tls-cert test.crt -tls-key test.key |
49 | | - fi |
50 | | - ${pkgs.dendrite}/bin/dendrite-monolith-server |
| 59 | + mkdir -p ${conduitHome} |
| 60 | + exec env CONDUIT_CONFIG=${conduitConfig} ${pkgs.matrix-conduit}/bin/conduit |
51 | 61 | ''; |
52 | 62 |
|
53 | 63 | # A script to setup test environment |
54 | | - dendriteSetup = pkgs.writeScriptBin "dendrite-setup" '' |
| 64 | + conduitSetup = pkgs.writeScriptBin "conduit-setup" '' |
55 | 65 | #!/bin/sh -e |
56 | | - cd ${dendriteHome} |
57 | | - HOMESERVER_URL=http://localhost:8008 |
| 66 | + HOMESERVER_URL=http://localhost:6167 |
| 67 | + export PATH=$PATH:${pkgs.jq}/bin:${pkgs.curl}/bin |
58 | 68 | create_token () { |
59 | | - ${pkgs.dendrite}/bin/create-account -username $1 -password $2 || true |
60 | | - ${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 |
61 | 75 | } |
62 | 76 | echo HOMESERVER_URL=$HOMESERVER_URL |
63 | 77 | echo PRIMARY_TOKEN=$(create_token "test-user" "test-pass") |
|
87 | 101 | pkgs.haskell-language-server |
88 | 102 | pkgs.ghcid |
89 | 103 | testScript |
90 | | - dendriteStart |
91 | | - dendriteSetup |
| 104 | + conduitStart |
| 105 | + conduitSetup |
92 | 106 | ]; |
93 | 107 |
|
94 | 108 | withHoogle = false; |
|
0 commit comments