From 96ea4f91951010ef9c560c13122a6f8ebfac2816 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 21 Jun 2018 10:44:11 +0200 Subject: refact: 1-1 folder-package --- clever-tools/default.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 47 ++--------------------------------------------- nodegit.nix | 43 ------------------------------------------- nodegit/default.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 88 deletions(-) create mode 100644 clever-tools/default.nix delete mode 100644 nodegit.nix create mode 100644 nodegit/default.nix diff --git a/clever-tools/default.nix b/clever-tools/default.nix new file mode 100644 index 0000000..8032014 --- /dev/null +++ b/clever-tools/default.nix @@ -0,0 +1,46 @@ +{ pkgs ? import {} }: + +with pkgs; + +let + version = "0.9.3"; + + nodegit = import ../nodegit/default.nix { inherit pkgs; }; + + libs = [ stdenv.cc.cc glibc ]; + +in + + stdenv.mkDerivation { + name = "clever-tools-${version}"; + + buildInputs = [ nodegit ]; + + src = fetchurl { + url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; + sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; + }; + + 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/default.nix b/default.nix index 9374e08..094b3b0 100644 --- a/default.nix +++ b/default.nix @@ -1,46 +1,3 @@ -{ pkgs ? import {} }: +with import {}; -with pkgs; - -let - version = "0.9.3"; - - nodegit = import ./nodegit.nix { inherit pkgs; }; - - libs = [ stdenv.cc.cc glibc ]; - -in - - stdenv.mkDerivation { - name = "clever-tools-${version}"; - - buildInputs = [ nodegit ]; - - src = fetchurl { - url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; - sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; - }; - - 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" - ''; - - } +callPackage ./clever-tools {} diff --git a/nodegit.nix b/nodegit.nix deleted file mode 100644 index aee9fcf..0000000 --- a/nodegit.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ 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}-node-v51"; - - src = fetchurl { - url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; - sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; - }; - - 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" - ''; - } diff --git a/nodegit/default.nix b/nodegit/default.nix new file mode 100644 index 0000000..aee9fcf --- /dev/null +++ b/nodegit/default.nix @@ -0,0 +1,43 @@ +{ 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}-node-v51"; + + src = fetchurl { + url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; + sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; + }; + + 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" + ''; + } -- cgit v1.2.3