summaryrefslogtreecommitdiffstats
path: root/nixos/tests/hoogle.nix
blob: 738680938e48319bdb952c5c2332ed735c47bf64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ lib, ... }:
{
  name = "hoogle";
  meta.maintainers = with lib.maintainers; [ h7x4 ];

  nodes.machine =
    { pkgs, ... }:
    {
      services.hoogle = {
        enable = true;
        packages =
          hp: with hp; [
            arrows
            lens
          ];
      };
    };

  testScript =
    { nodes, ... }:
    let
      cfg = nodes.machine.services.hoogle;
    in
    ''
      machine.wait_for_unit("hoogle.service")
      machine.wait_for_open_port(${toString cfg.port})

      machine.succeed("curl http://${cfg.host}:${toString cfg.port} | grep '<title>Hoogle</title>'")
      machine.succeed("curl 'http://${cfg.host}:${toString cfg.port}?hoogle=>>>' | grep Arrow")
    '';
}