nixpkgs/pkgs/applications/misc/azuredatastudio/default.nix

116 lines
2.7 KiB
Nix
Raw Normal View History

2020-02-20 07:17:44 +00:00
{ stdenv
, lib
, fetchurl
, makeWrapper
, libuuid
, libunwind
, icu
, openssl
, zlib
, curl
, at-spi2-core
, at-spi2-atk
, gnutar
, atomEnv
, kerberos
}:
# from justinwoo/azuredatastudio-nix
# https://github.com/justinwoo/azuredatastudio-nix/blob/537c48aa3981cd1a82d5d6e508ab7e7393b3d7c8/default.nix
stdenv.mkDerivation rec {
pname = "azuredatastudio";
version = "1.17.1";
src = fetchurl {
url = "https://azuredatastudiobuilds.blob.core.windows.net/releases/${version}/azuredatastudio-linux-${version}.tar.gz";
sha256 = "0px9n9vyjvyddca4x7d0zindd0dim7350vkjg5dd0506fm8dc38k";
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
libuuid
at-spi2-core
at-spi2-atk
];
phases = "unpackPhase fixupPhase";
# change this to azuredatastudio-insiders for insiders releases
edition = "azuredatastudio";
targetPath = "$out/${edition}";
unpackPhase = ''
mkdir -p ${targetPath}
${gnutar}/bin/tar xf $src --strip 1 -C ${targetPath}
'';
2021-01-15 05:42:41 +00:00
sqltoolsserviceRpath = lib.makeLibraryPath [
2020-02-20 07:17:44 +00:00
stdenv.cc.cc
libunwind
libuuid
icu
openssl
zlib
curl
];
# this will most likely need to be updated when azuredatastudio's version changes
sqltoolsservicePath = "${targetPath}/resources/app/extensions/mssql/sqltoolsservice/Linux/2.0.0-release.56";
2021-01-15 05:42:41 +00:00
rpath = lib.concatStringsSep ":" [
2020-02-20 07:17:44 +00:00
atomEnv.libPath
(
2021-01-15 05:42:41 +00:00
lib.makeLibraryPath [
2020-02-20 07:17:44 +00:00
libuuid
at-spi2-core
at-spi2-atk
stdenv.cc.cc.lib
kerberos
]
)
targetPath
sqltoolsserviceRpath
];
fixupPhase = ''
fix_sqltoolsservice()
{
mv ${sqltoolsservicePath}/$1 ${sqltoolsservicePath}/$1_old
patchelf \
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
${sqltoolsservicePath}/$1_old
makeWrapper \
${sqltoolsservicePath}/$1_old \
${sqltoolsservicePath}/$1 \
--set LD_LIBRARY_PATH ${sqltoolsserviceRpath}
}
fix_sqltoolsservice MicrosoftSqlToolsServiceLayer
fix_sqltoolsservice MicrosoftSqlToolsCredentials
fix_sqltoolsservice SqlToolsResourceProviderService
patchelf \
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
${targetPath}/${edition}
mkdir -p $out/bin
makeWrapper \
${targetPath}/bin/${edition} \
$out/bin/azuredatastudio \
--set LD_LIBRARY_PATH ${rpath}
'';
meta = {
2021-01-15 05:42:41 +00:00
maintainers = with lib.maintainers; [ xavierzwirtz ];
2020-02-20 07:17:44 +00:00
description = "A data management tool that enables working with SQL Server, Azure SQL DB and SQL DW";
homepage = "https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio";
license = lib.licenses.unfreeRedistributable;
};
}