From 7c2a7868b387ffd064dd14c51f7b18224cdc5c88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:04:58 +0200 Subject: [PATCH] nodegit and clever-tools from archives --- .gitignore | 1 + default.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ nodegit.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 default.nix create mode 100644 nodegit.nix diff --git a/.gitignore b/.gitignore index 1ee84da..92d225d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.sw* +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..65c872a --- /dev/null +++ b/default.nix @@ -0,0 +1,48 @@ +{ pkgs ? import {} }: + +with pkgs; + +let + version = "0.9.3"; + + nodegit = import ./nodegit.nix { inherit pkgs; }; + + libs = [ stdenv.cc.cc glibc ]; + +in + + stdenv.mkDerivation { + name = "clever-cli-${version}"; + + buildInputs = [ nodegit nodejs-6_x ]; + + src = fetchurl { + url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; + sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; + }; + + buildPhase = ":"; + + libPath = stdenv.lib.makeLibraryPath libs; + + nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ]; + + installPhase = '' + tar --extract --file=$src linux/clever --transform 's/linux\///' + bin=$out/bin/clever + mkdir -p $out/bin + mv clever $bin + ln -s "$nodegitLibrary/nodegit.node" "$out/bin/nodegit.node" + ''; + + dontStrip = "true"; + + preFixup = '' + bin=$out/bin/clever + patchelf \ + --set-rpath "$libPath" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + "$bin" + ''; + + } diff --git a/nodegit.nix b/nodegit.nix new file mode 100644 index 0000000..09f0969 --- /dev/null +++ b/nodegit.nix @@ -0,0 +1,45 @@ +{ pkgs }: + +let + version = "0.20.3"; + + stdenv = pkgs.stdenv; + fetchurl = pkgs.fetchurl; + + curl = pkgs.curl.override { + sslSupport = false; + gnutlsSupport = true; + }; + glibc = pkgs.glibc; + openssl = pkgs.openssl; + + libs = [ stdenv.cc.cc curl glibc openssl ]; + +in + + assert pkgs.stdenv.system == "x86_64-linux"; + + stdenv.mkDerivation { + name = "nodegit-${version}"; + + src = fetchurl { + url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; + sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; + }; + + buildPhase = ":"; + + libPath = stdenv.lib.makeLibraryPath libs; + + installPhase = '' + tar --extract --file=$src Release/nodegit.node --transform 's/Release\//linux-/' + lib=$out/lib/nodegit.node + mkdir -p $out/lib + mv linux-nodegit.node $lib + ''; + + preFixup = '' + lib=$out/lib/nodegit.node + patchelf --set-rpath "$libPath" "$lib" + ''; + } -- 2.41.0