nixpkgs/nixos/modules/services/development/hoogle.nix

77 lines
1.7 KiB
Nix
Raw Normal View History

2016-04-12 22:31:47 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.hoogle;
hoogleEnv = pkgs.buildEnv {
name = "hoogle";
paths = [ (cfg.haskellPackages.ghcWithHoogle cfg.packages) ];
};
2016-04-12 22:31:47 +02:00
in {
options.services.hoogle = {
enable = mkEnableOption "Haskell documentation server";
2016-04-12 22:31:47 +02:00
port = mkOption {
type = types.int;
default = 8080;
description = ''
Port number Hoogle will be listening to.
'';
};
packages = mkOption {
default = hp: [];
defaultText = "hp: []";
2016-04-12 22:31:47 +02:00
example = "hp: with hp; [ text lens ]";
description = ''
The Haskell packages to generate documentation for.
2016-04-12 22:31:47 +02:00
The option value is a function that takes the package set specified in
the <varname>haskellPackages</varname> option as its sole parameter and
returns a list of packages.
2016-04-12 22:31:47 +02:00
'';
};
haskellPackages = mkOption {
description = "Which haskell package set to use.";
default = pkgs.haskellPackages;
defaultText = "pkgs.haskellPackages";
2016-04-12 22:31:47 +02:00
};
2018-07-30 12:27:07 +02:00
home = mkOption {
type = types.str;
description = "Url for hoogle logo";
default = "https://hoogle.haskell.org";
};
2016-04-12 22:31:47 +02:00
};
config = mkIf cfg.enable {
systemd.services.hoogle = {
description = "Haskell documentation server";
2016-04-12 22:31:47 +02:00
wantedBy = [ "multi-user.target" ];
2016-04-12 22:31:47 +02:00
serviceConfig = {
Restart = "always";
2018-07-30 12:27:07 +02:00
ExecStart = ''${hoogleEnv}/bin/hoogle server --local --port ${toString cfg.port} --home ${cfg.home}'';
User = "nobody";
Group = "nogroup";
PrivateTmp = true;
ProtectHome = true;
RuntimeDirectory = "hoogle";
WorkingDirectory = "%t/hoogle";
2016-04-12 22:31:47 +02:00
};
};
};
}