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