1 { config, lib, pkgs, ... }:
4 cfg = config.services.hoogle;
6 hoogleEnv = pkgs.buildEnv {
8 paths = [ (cfg.haskellPackages.ghcWithHoogle cfg.packages) ];
13 options.services.hoogle = {
14 enable = lib.mkEnableOption "Haskell documentation server";
17 type = lib.types.port;
20 Port number Hoogle will be listening to.
24 packages = lib.mkOption {
25 type = lib.types.functionTo (lib.types.listOf lib.types.package);
27 defaultText = lib.literalExpression "hp: []";
28 example = lib.literalExpression "hp: with hp; [ text lens ]";
30 The Haskell packages to generate documentation for.
32 The option value is a function that takes the package set specified in
33 the {var}`haskellPackages` option as its sole parameter and
34 returns a list of packages.
38 haskellPackages = lib.mkOption {
39 description = "Which haskell package set to use.";
40 type = lib.types.attrs;
41 default = pkgs.haskellPackages;
42 defaultText = lib.literalExpression "pkgs.haskellPackages";
47 description = "Url for hoogle logo";
48 default = "https://hoogle.haskell.org";
53 description = "Set the host to bind on.";
54 default = "127.0.0.1";
57 extraOptions = lib.mkOption {
58 type = lib.types.listOf lib.types.str;
60 example = [ "--no-security-headers" ];
62 Additional command-line arguments to pass to
63 {command}`hoogle server`
68 config = lib.mkIf cfg.enable {
69 systemd.services.hoogle = {
70 description = "Haskell documentation server";
72 wantedBy = [ "multi-user.target" ];
77 ${hoogleEnv}/bin/hoogle server --local --port ${toString cfg.port} --home ${cfg.home} --host ${cfg.host} \
78 ${lib.concatStringsSep " " cfg.extraOptions}
85 RuntimeDirectory = "hoogle";
86 WorkingDirectory = "%t/hoogle";