1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/development/hoogle.nix

71 lines
1.5 KiB
Nix
Raw Normal View History

2016-04-12 21:31:47 +01: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 21:31:47 +01:00
in {
options.services.hoogle = {
enable = mkEnableOption "Haskell documentation server";
2016-04-12 21:31:47 +01: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 21:31:47 +01:00
example = "hp: with hp; [ text lens ]";
description = ''
The Haskell packages to generate documentation for.
2016-04-12 21:31:47 +01: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 21:31:47 +01:00
'';
};
haskellPackages = mkOption {
description = "Which haskell package set to use.";
default = pkgs.haskellPackages;
defaultText = "pkgs.haskellPackages";
2016-04-12 21:31:47 +01:00
};
};
config = mkIf cfg.enable {
systemd.services.hoogle = {
description = "Haskell documentation server";
2016-04-12 21:31:47 +01:00
wantedBy = [ "multi-user.target" ];
2016-04-12 21:31:47 +01:00
serviceConfig = {
Restart = "always";
ExecStart = ''${hoogleEnv}/bin/hoogle server --local -p ${toString cfg.port}'';
User = "nobody";
Group = "nogroup";
PrivateTmp = true;
ProtectHome = true;
RuntimeDirectory = "hoogle";
WorkingDirectory = "%t/hoogle";
2016-04-12 21:31:47 +01:00
};
};
};
}