summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-08-13 22:38:32 -0400
committerJohn Wiegley <johnw@newartisans.com>2014-08-16 00:13:14 -0500
commitdc285e6895e97355f769fdd6341b3e9c0cce2cf9 (patch)
tree955a2390d85357e811980893a1c639cea5f93f13 /pkgs/build-support
parent42c31e08df76515776396a04b5cd5e5961298441 (diff)
downloadnixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar.gz
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar.bz2
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar.lz
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar.xz
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.tar.zst
nixpkgs-dc285e6895e97355f769fdd6341b3e9c0cce2cf9.zip
cabal.mkDerivation: Use defaultMain if no Setup.{l,}hs exists.
This mirrors the default behaviour of cabal-install for the Simple build type
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cabal/default.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 69423004d65..7147b287fae 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -182,6 +182,12 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
               for i in Setup.hs Setup.lhs; do
                 test -f $i && ghc --make $i
               done
+              if [ ! -f Setup ]; then
+                  ghc --make ${builtins.toFile "Setup.hs" ''
+                    import Distribution.Simple
+                    main = defaultMain
+                  ''} -o Setup -odir $TMPDIR
+              fi
 
               for p in $extraBuildInputs $propagatedNativeBuildInputs; do
                 if [ -d "$p/lib/ghc-${ghc.ghc.version}/package.conf.d" ]; then