~jack/libtelnet-haskell

ref: 3b76fdedf4f32064e901989bbba737910b3e470b libtelnet-haskell/default.nix -rw-r--r-- 817 bytes
3b76fdedJack Kelly Add CI failure email 2 years ago
                                                                                
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
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "default"
, buildExample ? false
, doBenchmark ? false
}:

let
  inherit (nixpkgs) pkgs;

  haskellPackages =
    if compiler == "default"
    then pkgs.haskellPackages
    else pkgs.haskell.packages.${compiler};

  benchmarkVariant =
    if doBenchmark
    then pkgs.haskell.lib.doBenchmark
    else pkgs.lib.id;

  # Example code's build-depends are behind a flag, so cabal2nix
  # doesn't add them automatically.
  exampleVariant = pkg:
    if buildExample
    then with pkgs.haskell.lib; enableCabalFlag
      (addBuildDepends pkg (with haskellPackages; [monad-loops network-simple]))
      "example"
    else pkgs.lib.id;

  libtelnet = haskellPackages.callPackage ./libtelnet.nix {
    inherit (pkgs) libtelnet;
  };
in
  exampleVariant (benchmarkVariant libtelnet)