mirror of
https://github.com/hasura/graphql-engine.git
synced 2025-01-05 14:27:59 +03:00
Nix: Wrap GHC and HLS, specifically, to provide (DY)?LD_LIBRARY_PATH
.
We clearly do need this environment variable (at least on macOS); otherwise GHC spits out a slew of errors along the lines of "cannot find libodbc.dylib". However, adding it directly to the shell causes serious problems. Wrapping GHC should limit the damage. We've seen similar issues on macOS. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9203 Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com> GitOrigin-RevId: 9468d31e5b8ec86196809844842a1668386054bc
This commit is contained in:
parent
4b50704061
commit
3287181cc4
@ -39,7 +39,7 @@
|
||||
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
devShells.default = import ./nix/shell.nix { inherit pkgs; };
|
||||
devShells.default = import ./nix/shell.nix { inherit pkgs system; };
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,14 @@
|
||||
{ pkgs }:
|
||||
{ pkgs, system }:
|
||||
let
|
||||
versions = import ./versions.nix { inherit pkgs; };
|
||||
|
||||
# empty package, for shenanigans
|
||||
empty = builtins.derivation {
|
||||
inherit system;
|
||||
name = "empty";
|
||||
builder = pkgs.writeShellScript "null.sh" "${pkgs.coreutils}/bin/mkdir $out";
|
||||
};
|
||||
|
||||
# Unix ODBC Support
|
||||
freetdsWithODBC = pkgs.freetds.override {
|
||||
odbcSupport = true;
|
||||
@ -28,6 +35,40 @@ let
|
||||
configureFlags = [ "--disable-gui" "--sysconfdir=${odbcConfiguration}" ];
|
||||
});
|
||||
|
||||
# Ensure that GHC and HLS have access to all the dynamic libraries we have kicking around.
|
||||
ghc =
|
||||
let original = pkgs.haskell.compiler.${pkgs.ghcName};
|
||||
in pkgs.stdenv.mkDerivation
|
||||
{
|
||||
name = original.name;
|
||||
src = empty;
|
||||
buildInputs = [ original pkgs.makeWrapper ];
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper ${original}/bin/ghc "$out/bin/ghc" \
|
||||
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
|
||||
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
|
||||
'';
|
||||
};
|
||||
|
||||
hls =
|
||||
let original = pkgs.haskell.packages.${pkgs.ghcName}.haskell-language-server;
|
||||
in pkgs.stdenv.mkDerivation
|
||||
{
|
||||
name = original.name;
|
||||
src = empty;
|
||||
buildInputs = [ original pkgs.makeWrapper ];
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper ${original}/bin/haskell-language-server "$out/bin/haskell-language-server" \
|
||||
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
|
||||
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
|
||||
makeWrapper ${original}/bin/haskell-language-server-wrapper "$out/bin/haskell-language-server-wrapper" \
|
||||
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
|
||||
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
|
||||
'';
|
||||
};
|
||||
|
||||
baseInputs = [
|
||||
pkgs.stdenv
|
||||
pkgs.jq
|
||||
@ -56,15 +97,14 @@ let
|
||||
haskellInputs = [
|
||||
pkgs.cabal2nix
|
||||
|
||||
# The correct version of GHC.
|
||||
pkgs.haskell.compiler.${pkgs.ghcName}
|
||||
ghc
|
||||
hls
|
||||
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.alex
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.apply-refact
|
||||
(versions.ensureVersion pkgs.haskell.packages.${pkgs.ghcName}.cabal-install)
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.ghcid
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.happy
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.haskell-language-server
|
||||
(versions.ensureVersion pkgs.haskell.packages.${pkgs.ghcName}.hlint)
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.hoogle
|
||||
pkgs.haskell.packages.${pkgs.ghcName}.hspec-discover
|
||||
|
Loading…
Reference in New Issue
Block a user