summaryrefslogtreecommitdiff
path: root/shell.nix
blob: e9a5ecc88e4d7ce31b32818a0721fedcacf29146 (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
# Invoking nix-shell sets up an environment where we can build ghc
# by only invoking hadrian.


{ nixpkgs ? import <nixpkgs> {} }:

let
  haskellPackages = nixpkgs.haskell.packages.ghc821;

  removeBuild = path: type:
    let baseName = baseNameOf (toString path);
    in
        ! (baseName == "_build"
           || baseName == "dist"
           || baseName == "dist-newstyle"
           || baseName == ".stack-work"
           || baseName == "config.log"
           || baseName == "config.status"
           || nixpkgs.lib.hasSuffix ".sh" baseName
           || !(nixpkgs.lib.cleanSourceFilter path type)) ;

  filterSrc = path: builtins.filterSource removeBuild path;


  hadrianPackages = nixpkgs.haskell.packages.ghc821.override {
    overrides = self: super: let
        localPackage = name: path: self.callCabal2nix name (filterSrc path) {};
      in {
        hadrian = localPackage "hadrian" ./. ;
        shake = self.callHackage "shake" "0.16" {};
        Cabal = localPackage "Cabal" ./../libraries/Cabal/Cabal ;
        filepath = localPackage "filepath" ./../libraries/filepath ;
        text = localPackage "text" ./../libraries/text  ;
        hpc = localPackage"hpc" ./../libraries/hpc ;
        parsec = localPackage "parsec" ./../libraries/parsec ;
        HUnit = nixpkgs.haskell.lib.dontCheck (self.callHackage "HUnit" "1.3.1.2" {});
        process = localPackage "process" ./../libraries/process ;
        directory = localPackage "directory" ./../libraries/directory ;
      }; };

in

  nixpkgs.stdenv.mkDerivation {
    name = "ghc-dev";
    buildInputs = [
                    hadrianPackages.hadrian
                    nixpkgs.haskell.compiler.ghc821
                    haskellPackages.alex
                    haskellPackages.happy
                    nixpkgs.python3
                    nixpkgs.git
                    nixpkgs.autoconf
                    nixpkgs.automake
                    nixpkgs.perl
                    nixpkgs.gcc
                    nixpkgs.python3Packages.sphinx
                    nixpkgs.ncurses
                    nixpkgs.m4
                    nixpkgs.gmp
                    nixpkgs.file ];
  }