@@ -1,4 +1,36 @@
1−self: super: {
1+self: super:
3+ exactDeps = ghc: self.runCommand "ghc-exactdep-${ghc.version}" { nativeBuildInputs = [ ghc ]; } ''
4+ for P in $(${ghc.targetPrefix}ghc-pkg list --simple-output | sed 's/-[0-9][0-9.]*//g'); do
6+ touch $out/$P/configure-flags
7+ touch $out/$P/cabal.config
9+ if id=$(${ghc.targetPrefix}ghc-pkg field $P id --simple-output); then
10+ echo "--dependency=$P=$id" >> $out/$P/configure-flags
11+ elif id=$(${ghc.targetPrefix}ghc-pkg field "z-$P-z-*" id --simple-output); then
12+ name=$(${ghc.targetPrefix}ghc-pkg field "z-$P-z-*" name --simple-output)
13+ # so we are dealing with a sublib. As we build sublibs separately, the above
14+ # query should be safe.
15+ echo "--dependency=''${name#z-$P-z-}=$id" >> $out/$P/configure-flags
17+ if ver=$(${ghc.targetPrefix}ghc-pkg field $P version --simple-output); then
18+ echo "constraint: $P == $ver" >> $out/$P/cabal.config
19+ echo "constraint: $P installed" >> $out/$P/cabal.config
24+ envDeps = ghc: self.runCommand "ghc-envdep-${ghc.version}" { nativeBuildInputs = [ ghc ]; } ''
26+ for P in $(${ghc.targetPrefix}ghc-pkg list --simple-output | sed 's/-[0-9.]*//g'); do
28+ if id=$(${ghc.targetPrefix}ghc-pkg field $P id --simple-output); then
29+ echo "package-id $id" >> $out/$P
2 haskell-nix = super.haskell-nix // {
34 haskell-nix = super.haskell-nix // {
3 # Use this to disable the existing haskell infra structure for testing purposes
35 # Use this to disable the existing haskell infra structure for testing purposes
4 compiler =
36 compiler =
@@ -73,7 +105,7 @@ self: super: {
73 ghc844 = self.callPackage ../compiler/ghc {
105 ghc844 = self.callPackage ../compiler/ghc {
74 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc844; };
106 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc844; };
76− inherit bootPkgs sphinx;
108+ inherit bootPkgs sphinx exactDeps envDeps;
78 buildLlvmPackages = self.buildPackages.llvmPackages_5;
110 buildLlvmPackages = self.buildPackages.llvmPackages_5;
79 llvmPackages = self.llvmPackages_5;
111 llvmPackages = self.llvmPackages_5;
@@ -91,7 +123,7 @@ self: super: {
91 ghc861 = self.callPackage ../compiler/ghc {
123 ghc861 = self.callPackage ../compiler/ghc {
92 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc861; };
124 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc861; };
94− inherit bootPkgs sphinx;
126+ inherit bootPkgs sphinx exactDeps envDeps;
96 buildLlvmPackages = self.buildPackages.llvmPackages_5;
128 buildLlvmPackages = self.buildPackages.llvmPackages_5;
97 llvmPackages = self.llvmPackages_5;
129 llvmPackages = self.llvmPackages_5;
@@ -107,7 +139,7 @@ self: super: {
107 ghc862 = self.callPackage ../compiler/ghc {
139 ghc862 = self.callPackage ../compiler/ghc {
108 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc862; };
140 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc862; };
110− inherit bootPkgs sphinx;
142+ inherit bootPkgs sphinx exactDeps envDeps;
112 buildLlvmPackages = self.buildPackages.llvmPackages_5;
144 buildLlvmPackages = self.buildPackages.llvmPackages_5;
113 llvmPackages = self.llvmPackages_5;
145 llvmPackages = self.llvmPackages_5;
@@ -124,7 +156,7 @@ self: super: {
124 ghc863 = self.callPackage ../compiler/ghc {
156 ghc863 = self.callPackage ../compiler/ghc {
125 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc863; };
157 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc863; };
127− inherit bootPkgs sphinx;
159+ inherit bootPkgs sphinx exactDeps envDeps;
129 buildLlvmPackages = self.buildPackages.llvmPackages_5;
161 buildLlvmPackages = self.buildPackages.llvmPackages_5;
130 llvmPackages = self.llvmPackages_5;
162 llvmPackages = self.llvmPackages_5;
@@ -141,7 +173,7 @@ self: super: {
141 ghc864 = self.callPackage ../compiler/ghc {
173 ghc864 = self.callPackage ../compiler/ghc {
142 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc864; };
174 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc864; };
144− inherit bootPkgs sphinx;
176+ inherit bootPkgs sphinx exactDeps envDeps;
146 buildLlvmPackages = self.buildPackages.llvmPackages_5;
178 buildLlvmPackages = self.buildPackages.llvmPackages_5;
147 llvmPackages = self.llvmPackages_5;
179 llvmPackages = self.llvmPackages_5;
@@ -158,7 +190,7 @@ self: super: {
158 ghc865 = self.callPackage ../compiler/ghc {
190 ghc865 = self.callPackage ../compiler/ghc {
159 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc865; };
191 extra-passthru = { buildGHC = self.buildPackages.haskell-nix.compiler.ghc865; };
161− inherit bootPkgs sphinx;
193+ inherit bootPkgs sphinx exactDeps envDeps;
163 buildLlvmPackages = self.buildPackages.llvmPackages_5;
195 buildLlvmPackages = self.buildPackages.llvmPackages_5;
164 llvmPackages = self.llvmPackages_5;
196 llvmPackages = self.llvmPackages_5;
@@ -231,7 +263,13 @@ self: super: {
231 # compilers into the same place where nix expects them.
263 # compilers into the same place where nix expects them.
232 # We mark these compilers as boot compilers to make sure they are only used
264 # We mark these compilers as boot compilers to make sure they are only used
233 # where a boot compiler is expected.
265 # where a boot compiler is expected.
266+ compiler = builtins.mapAttrs (_: v:
234− compiler = builtins.mapAttrs (_: v: v // { isHaskellNixBootCompiler = true; })
268+ isHaskellNixBootCompiler = true;
269+ exactDeps = exactDeps v;
270+ envDeps = envDeps v;
235 (import ../compiler/old-ghc-nix { pkgs = self; });
273 (import ../compiler/old-ghc-nix { pkgs = self; });
237 packages = {
275 packages = {