9 stdenvNoCC.mkDerivation {
10 name = "hiawatha-test";
15 ] ++ lib.optional enableTls mbedtls;
22 cp -r --no-preserve=mode ${hiawatha}/etc/hiawatha config
23 sed "1i set TEST_DIR = $(pwd)" $serverConfigPath > config/hiawatha.conf
26 echo "it works" > www/index.html
28 if [ -n "$enableTls" ]; then
29 echo "Generating self-signed certificate"
30 gen_key type=ec filename=server.key
31 cert_write selfsign=1 issuer_key=server.key output_file=server.crt
32 cat server.crt server.key > config/server.crt
35 echo "Checking server configuration"
36 hiawatha -c ./config -k
38 echo "Starting server"
43 curl --verbose --insecure --fail "$1" | tee response
44 grep -q "it works" response
47 testUrl http://127.0.0.1:8000
48 if [ -n "$enableTls" ]; then
49 testUrl https://127.0.0.1:8443
56 # By default the server uses read-only directories like /var/lib and /etc
57 WorkDirectory = TEST_DIR
58 PIDfile = TEST_DIR/hiawatha.pid
59 SystemLogfile = TEST_DIR/system.log
60 GarbageLogfile = TEST_DIR/garbage.log
61 ExploitLogfile = TEST_DIR/exploit.log
62 AccessLogfile = TEST_DIR/access.log
63 ErrorLogfile = TEST_DIR/error.log
70 ${lib.optionalString enableTls ''
74 TLScertFile = TEST_DIR/config/server.crt
79 WebsiteRoot = TEST_DIR/www
80 StartFile = index.html
83 passAsFile = [ "serverConfig" ];