-
Notifications
You must be signed in to change notification settings - Fork 306
/
haskell.nix
53 lines (48 loc) · 1.25 KB
/
haskell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ pkgs, config, lib, ... }:
let
cfg = config.languages.haskell;
# ghc.version with removed dots
ghcVersion = lib.replaceStrings [ "." ] [ "" ] cfg.package.version;
in
{
options.languages.haskell = {
enable = lib.mkEnableOption "tools for Haskell development";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.ghc;
defaultText = "pkgs.ghc";
description = ''
Haskell compiler to use.
'';
};
languageServer = lib.mkOption {
type = lib.types.nullOr lib.types.package;
default = pkgs.haskell-language-server.override
{
supportedGhcVersions = [ ghcVersion ];
};
defaultText = "pkgs.haskell-language-server";
description = ''
Haskell language server to use.
'';
};
stack = lib.mkOption {
type = lib.types.nullOr lib.types.package;
default = pkgs.stack;
defaultText = "pkgs.stack";
description = ''
Haskell stack to use.
'';
};
};
config = lib.mkIf cfg.enable {
packages = with pkgs; [
cfg.package
cabal-install
zlib
hpack
]
++ (lib.optional (cfg.languageServer != null) cfg.languageServer)
++ (lib.optional (cfg.stack != null) cfg.stack);
};
}