From 5f36e60ee84ffa1a8d6c37365d44269e861ac4ae Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 18 Oct 2025 04:18:05 +0900 Subject: [PATCH] nixos/tests/hoogle: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/hoogle.nix | 31 +++++++++++++++++++++ pkgs/development/haskell-modules/hoogle.nix | 3 ++ 3 files changed, 35 insertions(+) create mode 100644 nixos/tests/hoogle.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 1f1f5ae5e043..32b77903a2f3 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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; diff --git a/nixos/tests/hoogle.nix b/nixos/tests/hoogle.nix new file mode 100644 index 000000000000..738680938e48 --- /dev/null +++ b/nixos/tests/hoogle.nix @@ -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 'Hoogle'") + machine.succeed("curl 'http://${cfg.host}:${toString cfg.port}?hoogle=>>>' | grep Arrow") + ''; +} diff --git a/pkgs/development/haskell-modules/hoogle.nix b/pkgs/development/haskell-modules/hoogle.nix index fb5d8bcb7dae..7d2e3517f979 100644 --- a/pkgs/development/haskell-modules/hoogle.nix +++ b/pkgs/development/haskell-modules/hoogle.nix @@ -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;