mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
c3afa0fdd7
This installs the ODBC Driver 18 for SQL Server in all our shipped Docker images, and update our tests and documentation accordingly. This version supports arm64, and therefore can run natively (or via Docker) on macOS on aarch64. `msodbcsql17` is still installed in production-targeted Docker images so that users do not _have_ to migrate to the new driver. Nix expressions are packaged for the new driver, as it is not yet available in nixpkgs. In this version, [the default encryption setting was changed from "no" to "yes"](https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228). In addition, "mandatory" and "optional" were added as synonyms for "yes" and "no" respectively. I have therefore modified all connection strings in tests to specify `Encrypt=optional` (and changed some from `Encrypt=no`). I chose "optional" rather than "no" because I feel it's more honest; these connection strings will work with or without an encrypted connection. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6241 GitOrigin-RevId: 959f88dd1f271ef06a3616bc46b358f364f6cdfd
57 lines
2.0 KiB
Nix
57 lines
2.0 KiB
Nix
# Copied from nixpkgs/pkgs/development/libraries/unixODBCDrivers/default.nix and modified heavily.
|
|
{ fetchurl, stdenv, lib, libiconv, unixODBC, fixDarwinDylibNames }:
|
|
stdenv.mkDerivation rec {
|
|
pname = "msodbcsql${versionMajor}";
|
|
version = "${versionMajor}.${versionMinor}.${versionAdditional}-1";
|
|
|
|
versionMajor = "18";
|
|
versionMinor = "1";
|
|
versionAdditional = "1.1";
|
|
|
|
src =
|
|
if stdenv.targetPlatform.isAarch64
|
|
then
|
|
fetchurl
|
|
{
|
|
url = "https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.1.1-arm64.tar.gz";
|
|
sha256 = "116xl8r2apr5b48jnq6myj9fwqs88yccw5176yfyzh4534fznj5x";
|
|
}
|
|
else
|
|
fetchurl
|
|
{
|
|
url = "https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.1.1-amd64.tar.gz";
|
|
sha256 = "1fn80byn1yihflznxcm9cpj42mpllnz54apnk9n46vzm2ng2lj6d";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
# Fix up the names encoded into the dylib, and make them absolute.
|
|
fixDarwinDylibNames
|
|
];
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
tar xf $src --strip-components=1 -C $out
|
|
'';
|
|
|
|
# Replace the hard-coded paths in the dylib with nixpkgs equivalents.
|
|
fixupPhase = ''
|
|
${stdenv.cc.bintools.targetPrefix}install_name_tool \
|
|
-change /usr/lib/libiconv.2.dylib ${libiconv}/lib/libiconv.2.dylib \
|
|
-change /opt/homebrew/lib/libodbcinst.2.dylib ${unixODBC}/lib/libodbcinst.2.dylib \
|
|
$out/lib/libmsodbcsql.${versionMajor}.dylib
|
|
'';
|
|
|
|
passthru = {
|
|
fancyName = "ODBC Driver ${versionMajor} for SQL Server";
|
|
driver = "lib/libmsodbcsql.${versionMajor}.dylib";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "ODBC Driver ${versionMajor} for SQL Server";
|
|
homepage = "https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017";
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
platforms = platforms.darwin;
|
|
license = licenses.unfree;
|
|
};
|
|
}
|