3 test_script = pkgs.stdenv.mkDerivation {
4 pname = "stargazer-test-script";
5 inherit (pkgs.stargazer) version src;
6 buildInputs = with pkgs; [
7 (python3.withPackages (
18 cp scripts/gemini-diagnostics $out/bin/test
21 test_env = pkgs.stdenv.mkDerivation {
22 pname = "stargazer-test-env";
23 inherit (pkgs.stargazer) version src;
25 cc test_data/cgi-bin/loop.c -o test_data/cgi-bin/loop
33 scgi_server = pkgs.stdenv.mkDerivation {
34 pname = "stargazer-test-scgi-server";
35 inherit (pkgs.stargazer) version src;
36 buildInputs = with pkgs; [ python3 ];
42 cp scripts/scgi-server $out/bin/scgi-server
48 meta = with lib.maintainers; {
49 maintainers = [ gaykitty ];
56 services.stargazer = {
58 connectionLogging = false;
63 root = "${test_env}/test_data/test_site";
66 route = "localhost=/en.gmi";
67 root = "${test_env}/test_data/test_site";
72 route = "localhost~/(.*).gemini";
73 root = "${test_env}/test_data/test_site";
79 route = "localhost=/plain.txt";
80 root = "${test_env}/test_data/test_site";
83 cert-path = "/var/lib/gemini/certs/localhost.crt";
84 key-path = "/var/lib/gemini/certs/localhost.key";
87 route = "localhost:/cgi-bin";
88 root = "${test_env}/test_data";
93 route = "localhost:/scgi";
95 scgi-address = "127.0.0.1:1099";
98 route = "localhost=/root";
103 route = "localhost=/priv.gmi";
104 root = "${test_env}/test_data/test_site";
105 client-cert = "${test_env}/test_data/client_cert/good.crt";
108 route = "example.com~(.*)";
109 redirect = "gemini://localhost";
113 route = "localhost:/no-exist";
114 root = "${test_env}/does_not_exist";
117 route = "localhost=/rss.xml";
118 root = "${test_env}/test_data/test_site";
119 mime-override = "application/atom+xml";
123 systemd.services.scgi_server = {
124 after = [ "network.target" ];
125 wantedBy = [ "multi-user.target" ];
127 ExecStart = "${scgi_server}/bin/scgi-server";
138 users.groups.cgi = { };
139 services.stargazer = {
141 connectionLogging = false;
146 route = "localhost:/cgi-bin";
147 root = "${test_env}/test_data";
160 geminiserver.wait_for_unit("scgi_server")
161 geminiserver.wait_for_open_port(1099)
162 geminiserver.wait_for_unit("stargazer")
163 cgiTestServer.wait_for_open_port(1965)
165 with subtest("stargazer test suite"):
166 response = geminiserver.succeed("sh -c 'cd ${test_env}; ${test_script}/bin/test'")
168 with subtest("stargazer cgi-user test"):
169 response = cgiTestServer.succeed("sh -c 'cd ${test_env}; ${test_script}/bin/test --checks CGIVars'")