hoogle service: init

wip/yesman
William Casarin 8 years ago committed by Joachim Fasting
parent a240d9509e
commit 9c0997a0ef
No known key found for this signature in database
GPG Key ID: 4330820E1E04DCF4
  1. 1
      nixos/modules/module-list.nix
  2. 68
      nixos/modules/services/development/hoogle.nix

@ -158,6 +158,7 @@
./services/desktops/gnome3/tracker.nix
./services/desktops/profile-sync-daemon.nix
./services/desktops/telepathy.nix
./services/development/hoogle.nix
./services/games/factorio.nix
./services/games/ghost-one.nix
./services/games/minecraft-server.nix

@ -0,0 +1,68 @@
{ config, lib, pkgs, ... }:
# services.hoogle = {
# enable = true;
# packages = hp: with hp; [ text lens ];
# haskellPackages = pkgs.haskellPackages;
# };
with lib;
let
cfg = config.services.hoogle;
ghcWithHoogle = pkgs.haskellPackages.ghcWithHoogle;
in {
options.services.hoogle = {
enable = mkEnableOption "Hoogle Documentation service";
port = mkOption {
type = types.int;
default = 8080;
description = ''
Port number Hoogle will be listening to.
'';
};
packages = mkOption {
default = hp: [];
example = "hp: with hp; [ text lens ]";
description = ''
A function that returns a list of Haskell packages to generate
documentation for.
The argument will be a Haskell package set provided by the
haskellPackages config option.
'';
};
haskellPackages = mkOption {
description = "Which haskell package set to use.";
example = "pkgs.haskellPackages";
type = types.attrs;
};
};
config = mkIf cfg.enable {
systemd.services.hoogle = {
description = "Hoogle Haskell documentation search";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Restart = "always";
ExecStart =
let env = cfg.haskellPackages.ghcWithHoogle cfg.packages;
hoogleEnv = pkgs.buildEnv {
name = "hoogleServiceEnv";
paths = [env];
};
in ''
${hoogleEnv}/bin/hoogle server --local -p ${toString cfg.port}
'';
};
};
};
}
Loading…
Cancel
Save