diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2018-04-10 13:22:43 +0100 |
---|---|---|
committer | Dominic Steinitz <dominic@steinitz.org> | 2018-04-10 13:22:43 +0100 |
commit | 6538dcb08e7a303bc1378d29c60812489089fd0f (patch) | |
tree | c35547ba3f72c475ae576afdfd40db34be34f699 /shell.nix | |
parent | 3f28b18d880f055c445f19ab3a982112a51c09d9 (diff) |
Another change of tack
Diffstat (limited to 'shell.nix')
-rw-r--r-- | shell.nix | 86 |
1 files changed, 24 insertions, 62 deletions
@@ -1,64 +1,26 @@ | |||
1 | { nixpkgs ? import <nixpkgs> {} | 1 | { nixpkgs ? import <nixpkgs> {} }: |
2 | , compiler ? "ghc822", doBenchmark ? false }: | 2 | let p = nixpkgs; in |
3 | |||
4 | let | ||
5 | |||
6 | inherit (nixpkgs) pkgs; | ||
7 | |||
8 | f = { mkDerivation, base, containers, diagrams-lib, diagrams-rasterific, gcc | ||
9 | , hmatrix, hmatrix-gsl, HUnit, inline-c, plots, stdenv | ||
10 | , template-haskell, temporary, vector }: | ||
11 | |||
12 | mkDerivation { | ||
13 | pname = "hmatrix-sundials"; | ||
14 | version = "0.1.0.0"; | ||
15 | src = ./.; | ||
16 | isLibrary = true; | ||
17 | isExecutable = true; | ||
18 | libraryHaskellDepends = [ | ||
19 | base | ||
20 | containers | ||
21 | hmatrix | ||
22 | inline-c | ||
23 | template-haskell | ||
24 | vector | ||
25 | ]; | ||
26 | executableHaskellDepends = [ | ||
27 | base | ||
28 | diagrams-lib | ||
29 | diagrams-rasterific | ||
30 | gcc | ||
31 | hmatrix | ||
32 | hmatrix-gsl | ||
33 | HUnit | ||
34 | inline-c | ||
35 | template-haskell | ||
36 | temporary | ||
37 | vector | ||
38 | ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Cocoa] else []); | ||
39 | executableSystemDepends = [ | ||
40 | pkgs.blas | ||
41 | pkgs.gfortran.cc | ||
42 | pkgs.liblapack | ||
43 | pkgs.gsl | ||
44 | pkgs.glpk | ||
45 | pkgs.pkgconfig | ||
46 | pkgs.stack | ||
47 | pkgs.sundials | ||
48 | pkgs.zlib | ||
49 | ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Accelerate] else []); | ||
50 | license = stdenv.lib.licenses.bsd3; | ||
51 | }; | ||
52 | |||
53 | haskellPackages = if compiler == "default" | ||
54 | then pkgs.haskellPackages | ||
55 | else pkgs.haskell.packages.${compiler}; | ||
56 | |||
57 | variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; | ||
58 | |||
59 | drv = variant (haskellPackages.callPackage f {}); | ||
60 | 3 | ||
4 | let | ||
5 | myStack = p.writeShellScriptBin "stack" '' | ||
6 | exec ${p.stack}/bin/stack --no-nix --no-docker --system-ghc $STACK_IN_NIX_EXTRA_ARGS "$@" | ||
7 | ''; | ||
61 | in | 8 | in |
62 | 9 | p.haskell.lib.buildStackProject { | |
63 | if pkgs.lib.inNixShell then drv.env else drv | 10 | name = "hmatrix"; |
64 | 11 | ||
12 | buildInputs = [ | ||
13 | p.zlib | ||
14 | p.sundials | ||
15 | p.blas | ||
16 | p.gfortran.cc | ||
17 | p.liblapack | ||
18 | p.gsl | ||
19 | p.glpk | ||
20 | p.pkgconfig | ||
21 | p.stack | ||
22 | p.sundials | ||
23 | myStack | ||
24 | ] ++ (if p.stdenv.isDarwin then [p.darwin.apple_sdk.frameworks.Accelerate] else []) | ||
25 | ++ (if p.stdenv.isDarwin then [p.darwin.apple_sdk.frameworks.Cocoa] else []); | ||
26 | } | ||