lol
1{ lib
2, stdenv
3, fetchurl
4, rpmextract
5, patchelf
6, makeWrapper
7, openssl
8, libxcrypt-legacy
9}:
10
11stdenv.mkDerivation rec {
12 pname = "snowsql";
13 version = "1.2.26";
14
15 src = fetchurl {
16 url = "https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/${lib.versions.majorMinor version}/linux_x86_64/snowflake-snowsql-${version}-1.x86_64.rpm";
17 sha256 = "sha256-V0TZebmhc463DczQuTDy0nZQX+io61z/m32/n/EKFJY=";
18 };
19
20 nativeBuildInputs = [ rpmextract makeWrapper ];
21
22 libPath = lib.makeLibraryPath [ openssl libxcrypt-legacy ];
23
24 buildCommand = ''
25 mkdir -p $out/bin/
26 cd $out
27 rpmextract $src
28 rm -R usr/bin
29 mv usr/* $out
30 rmdir usr
31
32 ${patchelf}/bin/patchelf \
33 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
34 lib64/snowflake/snowsql/snowsql
35
36 makeWrapper $out/lib64/snowflake/snowsql/snowsql $out/bin/snowsql \
37 --set LD_LIBRARY_PATH "${libPath}":"${placeholder "out"}"/lib64/snowflake/snowsql \
38 '';
39
40 meta = with lib; {
41 description = "Command line client for the Snowflake database";
42 homepage = "https://www.snowflake.com";
43 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
44 license = licenses.unfree;
45 maintainers = with maintainers; [ andehen ];
46 platforms = [ "x86_64-linux" ];
47 };
48}