on iko/ghcjs-patch-master help sign in
Improve hpack support (#800)
a904d40Hamish Mackenzie
builder/comp-builder.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, numactl, nodejs }:
1+{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, zlib, ncurses, numactl, nodejs }:
2lib.makeOverridable (
2lib.makeOverridable (
3let self =
3let self =
4{ componentId
4{ componentId
@@ -175,7 +175,7 @@ let
175 prePatch = if (cabalFile != null)
175 prePatch = if (cabalFile != null)
176 then ''cat ${cabalFile} > ${package.identifier.name}.cabal''
176 then ''cat ${cabalFile} > ${package.identifier.name}.cabal''
177 else lib.optionalString (cabal-generator == "hpack") ''
177 else lib.optionalString (cabal-generator == "hpack") ''
178− ${buildPackages.haskell-nix.haskellPackages.hpack.components.exes.hpack}/bin/hpack
178+ ${buildPackages.haskell-nix.nix-tools.${compiler.nix-name}}/bin/hpack
179 '';
179 '';
180 }
180 }
181 # patches can (if they like) depend on the version and revision of the package.
181 # patches can (if they like) depend on the version and revision of the package.
builder/default.nix+1−1
@@ -3,7 +3,7 @@
3let
3let
4 # Builds a single component of a package.
4 # Builds a single component of a package.
5 comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix {
5 comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix {
6− inherit ghc haskellLib makeConfigFiles haddockBuilder ghcForComponent hsPkgs;
6+ inherit ghc haskellLib makeConfigFiles haddockBuilder ghcForComponent hsPkgs compiler;
7 };
7 };
8
8
9 haddockBuilder = haskellLib.weakCallPackage pkgs ./haddock-builder.nix {
9 haddockBuilder = haskellLib.weakCallPackage pkgs ./haddock-builder.nix {
lib/call-cabal-project-to-nix.nix+18−5
@@ -340,11 +340,24 @@ let
340 fi
340 fi
341 cp -r ${maybeCleanedSource}/* .
341 cp -r ${maybeCleanedSource}/* .
342 chmod +w -R .
342 chmod +w -R .
343+ # Decide what to do for each `package.yaml` file.
344+ for hpackFile in $(find . -name package.yaml); do (
345+ # Look to see if a `.cabal` file exists
346+ shopt -u nullglob
347+ for cabalFile in $(dirname $hpackFile)/*.cabal; do
348+ if [ -e "$cabalFile" ]; then
349+ echo Ignoring $hpackFile as $cabalFile exists
350+ else
343− # warning: this may not generate the proper cabal file.
351+ # warning: this may not generate the proper cabal file.
344− # hpack allows globbing, and turns that into module lists
352+ # hpack allows globbing, and turns that into module lists
345− # without the source available (we cleaneSourceWith'd it),
353+ # without the source available (we cleaneSourceWith'd it),
346− # this may not produce the right result.
354+ # this may not produce the right result.
347− find . -name package.yaml -exec hpack "{}" \;
355+ echo No .cabal file found, running hpack on $hpackFile
356+ hpack $hpackFile
357+ fi
358+ done
359+ )
360+ done
348 ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
361 ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
349 ${fixedProject.makeFixedProjectFile}
362 ${fixedProject.makeFixedProjectFile}
350 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
363 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''