summaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorDominic Steinitz <dominic@steinitz.org>2018-03-28 11:20:23 +0100
committerDominic Steinitz <dominic@steinitz.org>2018-03-28 11:20:23 +0100
commitfb80f07072991ca1bddae0a19a266abbfb0a8341 (patch)
treec5280f54f3bcb7c3811a1f49d86d45c100ce06d1 /shell.nix
parent4d871f5372d8d242f4497de433433edec8e9e50c (diff)
Using hsc, semi-auto-generating documentation
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix115
1 files changed, 115 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..9566524
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,115 @@
1# From Mathieu's PR
2
3# {ghc}:
4
5# with import <nixpkgs> {};
6
7# let
8# gfortranlibdir = "${gfortran7.cc.lib}";
9# # XXX Workaround https://ghc.haskell.org/trac/ghc/ticket/11042.
10# libHack = if stdenv.isDarwin then {
11# DYLD_LIBRARY_PATH = [gfortranlibdir];
12# } else {
13# LD_LIBRARY_PATH = [gfortranlibdir];
14# };
15# in
16# haskell.lib.buildStackProject ({
17# name = "haskell-sundials";
18# buildInputs = [blas liblapack sundials zlib];
19# inherit ghc;
20# # XXX Workaround https://ghc.haskell.org/trac/ghc/ticket/11042.
21# extraArgs = ["--extra-lib-dirs=${gfortranlibdir}"];
22# } // libHack)
23
24
25{ nixpkgs ? import <nixpkgs>
26 {}
27, compiler ? "ghc822"
28, doBenchmark ? false }:
29
30let
31
32 inherit (nixpkgs) pkgs;
33
34f = { mkDerivation, ad, base, diagrams-lib, diagrams-rasterific, gcc
35 , hmatrix, hmatrix-gsl, inline-c, plots, pretty, stdenv, sundials, vector }:
36
37mkDerivation {
38 pname = "haskell-sundials";
39 version = "0.1.0.0";
40 src = ./.;
41 isLibrary = false;
42 isExecutable = true;
43 executableHaskellDepends = [
44 ad
45 base
46 diagrams-lib
47 diagrams-rasterific
48 gcc
49 hmatrix
50 hmatrix-gsl
51 inline-c
52 plots
53 pretty
54 vector
55 ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Cocoa] else []);
56 executableSystemDepends = [
57 pkgs.blas
58 pkgs.liblapack
59 patched-gsl
60 sundials
61 pkgs.zlib
62 ] ++ (if pkgs.stdenv.isDarwin then [pkgs.darwin.apple_sdk.frameworks.Accelerate] else []);
63 license = stdenv.lib.licenses.bsd3;
64};
65
66haskellPackages = if compiler == "default"
67 then pkgs.haskellPackages
68 else pkgs.haskell.packages.${compiler};
69
70variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
71
72patched-hmatrix = pkgs.haskellPackages.hmatrix.overrideAttrs (oldAttrs: rec {
73 src = nixpkgs.fetchgit {
74 url = git://github.com/albertoruiz/hmatrix;
75 rev = "d83b17190029c11e3ab8b504e5cdc917f5863120";
76 sha256 = "11wr59wg21rky59j3kkd3ba6aqns9gkh0r1fnhwhn3fp7zfhanqn";
77 };
78 postUnpack = ''
79 sourceRoot=''${sourceRoot}/packages/base
80 echo Source root reset to ''${sourceRoot}
81 '';
82});
83
84patched-hmatrix-gsl = pkgs.haskellPackages.hmatrix-gsl.overrideAttrs (oldAttrs: rec {
85 src = nixpkgs.fetchgit {
86 url = git://github.com/albertoruiz/hmatrix;
87 rev = "d83b17190029c11e3ab8b504e5cdc917f5863120";
88 sha256 = "11wr59wg21rky59j3kkd3ba6aqns9gkh0r1fnhwhn3fp7zfhanqn";
89 };
90 postUnpack = ''
91 sourceRoot=''${sourceRoot}/packages/gsl
92 echo Source root reset to ''${sourceRoot}
93 '';
94});
95
96patched-gsl = pkgs.gsl.overrideAttrs (oldAttrs: rec {
97 src = nixpkgs.fetchgit {
98 url = git://github.com/idontgetoutmuch/gsl;
99 rev = "c2035977d65cd804169ff3370da6723cf879be75";
100 sha256 = "1fqp77gp9nl3av1z58cwg8fivik4rff394wgjzc76ayd04y0d1k7";
101 };
102 version = "2.5";
103 name = "gsl-${version}";
104 doCheck = false;
105 CFLAGS = "-DDEBUG";
106});
107
108drv = variant (haskellPackages.callPackage f {
109 hmatrix = patched-hmatrix;
110 hmatrix-gsl = patched-hmatrix-gsl;
111});
112
113in
114
115 if pkgs.lib.inNixShell then drv.env else drv