diff options
author | Ben Gamari <ben@smart-cactus.org> | 2017-11-22 08:47:55 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-11-22 08:49:26 -0500 |
commit | 360d7404809b3fa54541f7f932a6864294f75a4a (patch) | |
tree | 49a33f926522faeca5633f5241badf3e410b4717 /shell.nix | |
parent | c1fcd9b3f60e8420dd228cd4e3efeb9cfa793aa5 (diff) | |
download | haskell-360d7404809b3fa54541f7f932a6864294f75a4a.tar.gz |
Squashed 'hadrian/' changes from fa3771fe6b..4499b294e4
4499b294e4 Follow GHC changes
8fd68186b2 Add ways to build hadrian using nix
e5c7a29c23 Do not depend on the in-tree filepath library
9dd7ad2acc Fix dependencies
497184390e Bring mtl dependency back
6c5f5c9bd9 Minor clean up of Hadrian dependencies
9aff81d424 Fix Windows build
fa95caa8df Unbreak `cabal new-build`
git-subtree-dir: hadrian
git-subtree-split: 4499b294e4a53f71f8808d6eb55a7dd0b341cfb8
Diffstat (limited to 'shell.nix')
-rw-r--r-- | shell.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000000..e9a5ecc88e --- /dev/null +++ b/shell.nix @@ -0,0 +1,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 ]; + } |