at master 876 B view raw
1{ pkgs, ... }: 2{ 3 name = "merecat"; 4 meta = with pkgs.lib.maintainers; { 5 maintainers = [ fgaz ]; 6 }; 7 8 nodes.machine = 9 { config, pkgs, ... }: 10 { 11 services.merecat = { 12 enable = true; 13 settings = { 14 hostname = "localhost"; 15 virtual-host = true; 16 directory = toString ( 17 pkgs.runCommand "merecat-webdir" { } '' 18 mkdir -p $out/foo.localhost $out/bar.localhost 19 echo '<h1>Hello foo</h1>' > $out/foo.localhost/index.html 20 echo '<h1>Hello bar</h1>' > $out/bar.localhost/index.html 21 '' 22 ); 23 }; 24 }; 25 }; 26 27 testScript = '' 28 machine.wait_for_unit("merecat") 29 machine.wait_for_open_port(80) 30 machine.succeed("curl --fail foo.localhost | grep 'Hello foo'") 31 machine.succeed("curl --fail bar.localhost | grep 'Hello bar'") 32 ''; 33}