mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
nix: Bake the ODBC configuration path into unixODBC.
The previous method seems to be failing; we're not finding the drivers. Rather than using environment variables to tell unixODBC where to find odbcinst.ini, we can instead just configure it to point to the correct location and bake it into the binary. This means we need to build unixODBC ourselves, but it's pretty quick, so doesn't seem like much of an issue. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8491 GitOrigin-RevId: 7d331c4205d412b7757c0f1efd5b6a00a10e2ad4
This commit is contained in:
parent
e238e0f295
commit
042046bba7
@ -5,7 +5,7 @@ let
|
|||||||
# Unix ODBC Support
|
# Unix ODBC Support
|
||||||
freetdsWithODBC = pkgs.freetds.override {
|
freetdsWithODBC = pkgs.freetds.override {
|
||||||
odbcSupport = true;
|
odbcSupport = true;
|
||||||
inherit (pkgs) unixODBC;
|
inherit unixODBC;
|
||||||
};
|
};
|
||||||
|
|
||||||
msodbcsql = pkgs.unixODBCDrivers.msodbcsql18;
|
msodbcsql = pkgs.unixODBCDrivers.msodbcsql18;
|
||||||
@ -14,15 +14,20 @@ let
|
|||||||
# The output should be the headings from the odbcinst.ini file.
|
# The output should be the headings from the odbcinst.ini file.
|
||||||
# (You can easily see the generated file by running `cat $ODBCINSTINI`.)
|
# (You can easily see the generated file by running `cat $ODBCINSTINI`.)
|
||||||
# If you see any errors, please contact your friendly MSSQL and/or Nix expert.
|
# If you see any errors, please contact your friendly MSSQL and/or Nix expert.
|
||||||
odbcinstFile = pkgs.writeTextFile {
|
odbcConfiguration = pkgs.writeTextFile {
|
||||||
name = "odbcinst.ini";
|
name = "odbc-configuration";
|
||||||
text = ''
|
text = ''
|
||||||
[${msodbcsql.fancyName}]
|
[${msodbcsql.fancyName}]
|
||||||
Description = ${msodbcsql.meta.description}
|
Description = ${msodbcsql.meta.description}
|
||||||
Driver = ${msodbcsql}/${msodbcsql.driver}
|
Driver = ${msodbcsql}/${msodbcsql.driver}
|
||||||
'';
|
'';
|
||||||
|
destination = "/odbcinst.ini";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unixODBC = pkgs.unixODBC.overrideAttrs (oldAttrs: {
|
||||||
|
configureFlags = [ "--disable-gui" "--sysconfdir=${odbcConfiguration}" ];
|
||||||
|
});
|
||||||
|
|
||||||
baseInputs = [
|
baseInputs = [
|
||||||
pkgs.stdenv
|
pkgs.stdenv
|
||||||
pkgs.jq
|
pkgs.jq
|
||||||
@ -93,7 +98,7 @@ let
|
|||||||
pkgs.libmysqlclient
|
pkgs.libmysqlclient
|
||||||
pkgs.mariadb
|
pkgs.mariadb
|
||||||
pkgs.postgresql_15
|
pkgs.postgresql_15
|
||||||
pkgs.unixODBC
|
unixODBC
|
||||||
msodbcsql
|
msodbcsql
|
||||||
]
|
]
|
||||||
# Linux-specific libraries.
|
# Linux-specific libraries.
|
||||||
@ -118,11 +123,6 @@ in
|
|||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = baseInputs ++ consoleInputs ++ docsInputs ++ serverDeps ++ devInputs ++ ciInputs;
|
buildInputs = baseInputs ++ consoleInputs ++ docsInputs ++ serverDeps ++ devInputs ++ ciInputs;
|
||||||
|
|
||||||
# We set the ODBCINSTINI to the file defined above, which points to the MSSQL ODBC driver.
|
|
||||||
# The path is relative to `ODBCSYSINI`, which we set to empty.
|
|
||||||
ODBCSYSINI = "";
|
|
||||||
ODBCINSTINI = "${odbcinstFile}";
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath dynamicLibraries;
|
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath dynamicLibraries;
|
||||||
shellHook = pkgs.lib.strings.optionalString pkgs.stdenv.targetPlatform.isDarwin ''
|
shellHook = pkgs.lib.strings.optionalString pkgs.stdenv.targetPlatform.isDarwin ''
|
||||||
# Without this, GHC will use the system `libcrypto` and `libssl` libraries, which fail.
|
# Without this, GHC will use the system `libcrypto` and `libssl` libraries, which fail.
|
||||||
|
Loading…
Reference in New Issue
Block a user