···
{ config, lib, pkgs, ... }:
3
-
# services.hoogle = {
5
-
# packages = hp: with hp; [ text lens ];
6
-
# haskellPackages = pkgs.haskellPackages;
cfg = config.services.hoogle;
14
-
ghcWithHoogle = pkgs.haskellPackages.ghcWithHoogle;
9
+
hoogleEnv = pkgs.buildEnv {
11
+
paths = [ (cfg.haskellPackages.ghcWithHoogle cfg.packages) ];
options.services.hoogle = {
19
-
enable = mkEnableOption "Hoogle Documentation service";
17
+
enable = mkEnableOption "Haskell documentation server";
···
29
+
defaultText = "hp: []";
example = "hp: with hp; [ text lens ]";
33
-
A function that returns a list of Haskell packages to generate
32
+
The Haskell packages to generate documentation for.
36
-
The argument will be a Haskell package set provided by the
37
-
haskellPackages config option.
34
+
The option value is a function that takes the package set specified in
35
+
the <varname>haskellPackages</varname> option as its sole parameter and
36
+
returns a list of packages.
haskellPackages = mkOption {
description = "Which haskell package set to use.";
43
-
example = "pkgs.haskellPackages";
42
+
default = pkgs.haskellPackages;
43
+
defaultText = "pkgs.haskellPackages";
config = mkIf cfg.enable {
systemd.services.hoogle = {
51
-
description = "Hoogle Haskell documentation search";
50
+
description = "Haskell documentation server";
wantedBy = [ "multi-user.target" ];
56
-
let env = cfg.haskellPackages.ghcWithHoogle cfg.packages;
57
-
hoogleEnv = pkgs.buildEnv {
58
-
name = "hoogleServiceEnv";
62
-
${hoogleEnv}/bin/hoogle server --local -p ${toString cfg.port}
56
+
ExecStart = ''${hoogleEnv}/bin/hoogle server --local -p ${toString cfg.port}'';
64
+
RuntimeDirectory = "hoogle";
65
+
WorkingDirectory = "%t/hoogle";