build: Nix environment
[barrelfish] / default.nix
1 { stdenv, fetchgit, haskell
2
3 , autoconf
4 , automake
5 , binutils
6 , coreutils
7 , curl
8 , gcc5
9 , git
10 , gmp
11 , gnugrep
12 , gnused
13 , m4
14
15 , ghc-version ? "ghc801"
16
17 , propagate-deps ? false
18 , use-repo-source ? false
19 , repo-url ? ""
20 , repo-commit-id ? ""
21 , repo-commit-sha256 ? ""
22 }:
23
24 let src-repo = fetchgit {
25       url    = repo-url;
26       rev    = repo-commit-id;
27       sha256 = repo-commit-sha256;
28     };
29     ghc        = haskell.packages."${ghc-version}".ghcWithPackages
30                      (haskellPackages: with haskellPackages; [
31                         async
32                         bytestring-trie
33                         ghc-paths
34                         ghc-mtl
35                         haskell-src-exts
36                         parsec
37                         random
38                      ]);
39     deps       = [
40         autoconf
41         automake
42         binutils
43         coreutils
44         curl
45         gcc5
46         git
47         gmp
48         gnugrep
49         gnused
50         m4
51
52         # custom GHC
53         ghc
54     ];
55 in
56 stdenv.mkDerivation {
57         version = "2016-11-09";
58         name    = "barrelfish";
59         src     = if use-repo-source
60                   then src-repo
61                   else builtins.filterSource
62                        (path: type: baseNameOf path != ".git" && baseNameOf path != "build")
63                        ./.;
64
65         buildInputs = deps;
66         propagatedBuildInputs = if propagate-deps
67                                 then deps
68                                 else [];
69
70         description = "The Barrelfish OS";
71         license = "MIT";
72 }