nixos/tests/hoogle: init

This commit is contained in:
h7x4
2025-10-18 04:18:05 +09:00
parent 4e4dfda28b
commit 5f36e60ee8
3 changed files with 35 additions and 0 deletions

View File

@@ -718,6 +718,7 @@ in
homepage-dashboard = runTest ./homepage-dashboard.nix;
homer = handleTest ./homer { };
honk = runTest ./honk.nix;
hoogle = runTest ./hoogle.nix;
hostname = handleTest ./hostname.nix { };
hound = runTest ./hound.nix;
hub = runTest ./git/hub.nix;

31
nixos/tests/hoogle.nix Normal file
View File

@@ -0,0 +1,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")
'';
}

View File

@@ -9,6 +9,7 @@
haskellPackages,
writeText,
runCommand,
nixosTests,
}:
# This argument is a function which selects a list of Haskell packages from any
@@ -137,6 +138,8 @@ buildPackages.stdenv.mkDerivation (finalAttrs: {
'';
};
passthru.tests.nixos = nixosTests.hoogle;
meta = {
description = "Local Hoogle database";
platforms = ghc.meta.platforms;