Created
January 16, 2018 21:20
-
-
Save chessai/6311b8710a438bbd3ba8ea1fdf76826a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Invoking nix-shell sets up an environment where we can build ghc | |
# by only invoking hadrian. | |
{ package ? "ghc-dev", compiler ? "ghc822" }: | |
let | |
fetchNixpkgs = import ./fetchNixpkgs.nix; | |
nixpkgs = fetchNixpkgs { | |
rev = "01705125314fa0c7753f27c3dd7c4bfbda55c375"; | |
sha256 = "1a96vb4hlhnadm445lifq02wg2vz0a2hyxrcl6d0jy2cn7427aq6"; | |
}; | |
pkgs = import nixpkgs { config = {}; }; | |
inherit (pkgs) haskell; | |
haskellPackages = 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" | |
|| pkgs.lib.hasSuffix ".sh" baseName | |
|| !(pkgs.lib.cleanSourceFilter path type)) ; | |
filterSrc = path: builtins.filterSource removeBuild path; | |
hadrianPackages = haskell.packages.${compiler}.override { | |
overrides = self: super: | |
with haskell.lib; | |
with { localPackage = name: path: self.callCabal2nix name (filterSrc path) {}; | |
}; | |
{ | |
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 | |
pkgs.stdenv.mkDerivation { | |
name = "ghc-dev"; | |
buildInputs = [ | |
hadrianPackages.hadrian | |
haskell.compiler.ghc821 | |
haskellPackages.alex | |
haskellPackages.happy | |
pkgs.python3 | |
pkgs.git | |
pkgs.autoconf | |
pkgs.automake | |
pkgs.perl | |
pkgs.gcc | |
pkgs.python3Packages.sphinx | |
pkgs.ncurses | |
pkgs.m4 | |
pkgs.gmp | |
pkgs.file ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment