1 { config, lib, pkgs, ... }:
7 cfg = config.services.hoogle;
9 hoogleEnv = pkgs.buildEnv {
11 paths = [ (cfg.haskellPackages.ghcWithHoogle cfg.packages) ];
16 options.services.hoogle = {
17 enable = mkEnableOption (lib.mdDoc "Haskell documentation server");
22 description = lib.mdDoc ''
23 Port number Hoogle will be listening to.
28 type = types.functionTo (types.listOf types.package);
30 defaultText = literalExpression "hp: []";
31 example = literalExpression "hp: with hp; [ text lens ]";
32 description = lib.mdDoc ''
33 The Haskell packages to generate documentation for.
35 The option value is a function that takes the package set specified in
36 the {var}`haskellPackages` option as its sole parameter and
37 returns a list of packages.
41 haskellPackages = mkOption {
42 description = lib.mdDoc "Which haskell package set to use.";
44 default = pkgs.haskellPackages;
45 defaultText = literalExpression "pkgs.haskellPackages";
50 description = lib.mdDoc "Url for hoogle logo";
51 default = "https://hoogle.haskell.org";
56 description = lib.mdDoc "Set the host to bind on.";
57 default = "127.0.0.1";
61 config = mkIf cfg.enable {
62 systemd.services.hoogle = {
63 description = "Haskell documentation server";
65 wantedBy = [ "multi-user.target" ];
69 ExecStart = ''${hoogleEnv}/bin/hoogle server --local --port ${toString cfg.port} --home ${cfg.home} --host ${cfg.host}'';
75 RuntimeDirectory = "hoogle";
76 WorkingDirectory = "%t/hoogle";