Skip to content

Commit 8f8a8e1

Browse files
committed
Patch from input-output-hk#31
1 parent c466c7e commit 8f8a8e1

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

builder/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ in {
5757
# Build a Haskell package from its config.
5858
# TODO: this pkgs is the adjusted pkgs, but pkgs.pkgs is unadjusted
5959
build-package = haskellLib.weakCallPackage pkgs ./hspkg-builder.nix {
60-
inherit haskellLib ghc buildGHC comp-builder setup-builder;
60+
inherit haskellLib ghc buildGHC comp-builder setup-builder makeSetupConfigFiles;
6161
};
6262

6363
inherit shellFor;

builder/hspkg-builder.nix

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, buildGHC, fetchurl, runCommand, comp-builder, setup-builder }:
1+
{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, buildGHC, fetchurl, runCommand, comp-builder, setup-builder, makeSetupConfigFiles }:
22

33

44
{ flags
@@ -12,6 +12,7 @@
1212
, revision
1313
, revisionSha256
1414
, patches
15+
, hardeningDisable
1516

1617
, shellHook
1718

@@ -30,22 +31,40 @@ let
3031
import Distribution.Simple
3132
main = defaultMain
3233
'';
33-
defaultSetup = buildPackages.runCommand "default-Setup" { nativeBuildInputs = [buildGHC]; } ''
34-
cat ${defaultSetupSrc} > Setup.hs
35-
mkdir -p $out/bin
36-
${buildGHC.targetPrefix}ghc Setup.hs --make -o $out/bin/Setup
37-
'';
34+
defaultConfig = makeSetupConfigFiles {
35+
inherit (package) identifier;
36+
inherit (config) flags;
37+
fullName = "${name}-setup";
38+
component = {
39+
depends = [];
40+
libs = [];
41+
frameworks = [];
42+
doExactConfig = false;
43+
};
44+
};
45+
defaultSetup =
46+
buildPackages.runCommand
47+
"default-Setup"
48+
{ nativeBuildInputs = [buildGHC];
49+
CABAL_CONFIG = defaultConfig + /cabal.config;
50+
}
51+
''
52+
cat ${defaultSetupSrc} > Setup.hs
53+
mkdir -p $out/bin
54+
${buildGHC.targetPrefix}ghc Setup.hs --make -o $out/bin/Setup
55+
'';
3856

3957
setup = if package.buildType == "Simple"
4058
then defaultSetup
4159
else setup-builder {
4260
setup-depends = package.setup-depends;
4361
inherit package name src flags;
62+
postUnpack = config.postUnpack;
4463
};
4564

4665
buildComp = componentId: component: comp-builder {
4766
inherit componentId component package name src flags setup cabalFile cabal-generator patches revision
48-
shellHook
67+
shellHook hardeningDisable
4968
;
5069
};
5170

0 commit comments

Comments
 (0)