Skip to content

Commit 55d6ca3

Browse files
committed
Fix iserv-proxy in dev shells
1 parent 5212c99 commit 55d6ca3

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

builder/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let
4141
# component builder and for nix-shells.
4242
ghcForComponent = import ./ghc-for-component-wrapper.nix {
4343
inherit lib ghc haskellLib;
44-
inherit (buildPackages) stdenv;
44+
inherit (pkgs) stdenv;
4545
inherit (buildPackages.buildPackages) runCommand makeWrapper;
4646
inherit (buildPackages.buildPackages.xorg) lndir;
4747
};

builder/ghc-for-component-wrapper.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
, postInstall ? ""
1515
, enableDWARF
1616
, plugins
17+
, ghcOptions ? []
1718
}:
1819

1920
let
@@ -107,7 +108,7 @@ let
107108
--set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
108109
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
109110
--set "GHC_PLUGINS" "$GHC_PLUGINS" \
110-
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
111+
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"${lib.concatMapStrings (o: " --add-flags ${o}") ghcOptions}
111112
fi
112113
done
113114
@@ -159,8 +160,7 @@ let
159160
inherit script targetPrefix;
160161
inherit (ghc) version meta;
161162
};
162-
propagatedBuildInputs = configFiles.libDeps;
163-
nativeBuildInputs = [ghc];
163+
propagatedBuildInputs = configFiles.libDeps ++ [stdenv.cc ghc];
164164
} (''
165165
mkdir -p $out/configFiles
166166
configFiles=$out/configFiles

builder/shell-for.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ let
143143
'';
144144
inherit enableDWARF;
145145
plugins = [];
146+
ghcOptions = haskell-nix.templateHaskell.${compiler.nix-name}.ghcOptions or [];
146147
};
147148

148149
hoogleIndex = let
@@ -192,11 +193,16 @@ in
192193
''} $(builtin type -P "${ghcEnv.targetPrefix}pkg-config" &> /dev/null && echo "--with-pkg-config=${ghcEnv.targetPrefix}pkg-config") \
193194
"$@"
194195
'');
196+
propagatedBuildInputs = mkDrvArgs.propagateBuildInputs or [] ++ ghcEnv.drv.propagatedBuildInputs;
195197
phases = ["installPhase"];
196198
installPhase = ''
197199
echo "${"Shell for " + toString (builtins.map (p : p.identifier.name) selectedPackages)}"
198200
echo $nativeBuildInputs $buildInputs > $out
199201
'';
202+
shellHook = mkDrvArgs.shellHook or "" + lib.optionalString stdenv.hostPlatform.isWindows ''
203+
204+
export pkgsHostTargetAsString="''${pkgsHostTarget[@]}"
205+
'';
200206

201207
# This helps tools like `ghcide` (that use the ghc api) to find
202208
# the correct global package DB.

test/th-dlls/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ let
77
project = externalInterpreter: project' {
88
inherit compiler-nix-name evalPackages;
99
src = testSrc "th-dlls";
10-
cabalProjectLocal = builtins.readFile ../cabal.project.local;
1110
modules = import ../modules.nix ++ [({pkgs, ...}: lib.optionalAttrs externalInterpreter {
1211
packages.th-dlls.components.library.ghcOptions = [ "-fexternal-interpreter" ];
1312
# Static openssl seems to fail to load in iserv for musl
1413
packages.HsOpenSSL.components.library.libs = lib.optional pkgs.stdenv.hostPlatform.isMusl (pkgs.openssl.override { static = false; });
1514
})];
15+
shell.nativeBuildInputs = [ buildPackages.haskell-nix.nix-tools-unchecked.exes.cabal ];
1616
};
1717

1818
packages = (project false).hsPkgs;

0 commit comments

Comments
 (0)