]> git.immae.eu Git - github/fretlink/clever-tools-nix.git/commitdiff
nodegit and clever-tools from archives
authorFrédéric Menou <frederic.menou@fretlink.com>
Tue, 19 Jun 2018 22:04:58 +0000 (00:04 +0200)
committerFrédéric Menou <frederic.menou@fretlink.com>
Tue, 19 Jun 2018 22:04:58 +0000 (00:04 +0200)
.gitignore
default.nix [new file with mode: 0644]
nodegit.nix [new file with mode: 0644]

index 1ee84da9887ff9c23cf4f62eb48fa186b8fcd963..92d225db91787a51d9cdd61676fbabb879397b32 100644 (file)
@@ -1 +1,2 @@
 *.sw*
+result
diff --git a/default.nix b/default.nix
new file mode 100644 (file)
index 0000000..65c872a
--- /dev/null
@@ -0,0 +1,48 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+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 (file)
index 0000000..09f0969
--- /dev/null
@@ -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"
+    '';
+  }