summaryrefslogtreecommitdiff
path: root/shell.nix
blob: d22f886e6495c71bd4757321edb0cecaa8d5cc73 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "ghc822", doBenchmark ? false }:

let

  inherit (nixpkgs) pkgs;

f = { mkDerivation, base, containers, diagrams-lib, diagrams-rasterific, gcc
    , hmatrix, hmatrix-gsl, HUnit, inline-c, plots, stdenv
    , template-haskell, temporary, vector }:

mkDerivation {
  pname = "hmatrix-sundials";
  version = "0.1.0.0";
  src = ./.;
  isLibrary = true;
  isExecutable = true;
  libraryHaskellDepends = [
    base
    containers
    hmatrix
    inline-c
    template-haskell
    vector
  ];
  executableHaskellDepends = [
    base
    diagrams-lib
    diagrams-rasterific
    gcc
    hmatrix
    hmatrix-gsl
    HUnit
    inline-c
    template-haskell
    temporary
    vector
  ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Cocoa] else []);
  executableSystemDepends = [
    pkgs.blas
    pkgs.gfortran.cc
    pkgs.liblapack
    pkgs.gsl
    pkgs.glpk
    pkgs.pkgconfig
    pkgs.stack
    pkgs.sundials
    pkgs.zlib
  ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Accelerate] else []);
  license = stdenv.lib.licenses.bsd3;
};

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

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

  drv = variant (haskellPackages.callPackage f {});

in

  if pkgs.lib.inNixShell then drv.env else drv