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 From 8be0d90992efd13b71166cd32d0fc6f10a6ed600 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 21 Jun 2018 10:48:03 +0200 Subject: refact: make packages function-like --- clever-tools/default.nix | 7 +------ default.nix | 4 +++- nodegit/default.nix | 14 ++++---------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/clever-tools/default.nix b/clever-tools/default.nix index 8032014..497e911 100644 --- a/clever-tools/default.nix +++ b/clever-tools/default.nix @@ -1,14 +1,9 @@ -{ pkgs ? import {} }: - -with pkgs; +{ stdenv, fetchurl, glibc, nodegit }: let version = "0.9.3"; - nodegit = import ../nodegit/default.nix { inherit pkgs; }; - libs = [ stdenv.cc.cc glibc ]; - in stdenv.mkDerivation { diff --git a/default.nix b/default.nix index 094b3b0..84ed9be 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,5 @@ with import {}; -callPackage ./clever-tools {} +callPackage ./clever-tools { + nodegit = callPackage ./nodegit {}; +} diff --git a/nodegit/default.nix b/nodegit/default.nix index aee9fcf..83d734a 100644 --- a/nodegit/default.nix +++ b/nodegit/default.nix @@ -1,23 +1,17 @@ -{ pkgs }: +{ stdenv, fetchurl, curl, glibc, openssl }: let version = "0.20.3"; - stdenv = pkgs.stdenv; - fetchurl = pkgs.fetchurl; - - curl = pkgs.curl.override { + curlWithGnutls = curl.override { sslSupport = false; gnutlsSupport = true; }; - glibc = pkgs.glibc; - openssl = pkgs.openssl; - - libs = [ stdenv.cc.cc curl glibc openssl ]; + libs = [ stdenv.cc.cc curlWithGnutls glibc openssl ]; in - assert pkgs.stdenv.system == "x86_64-linux"; + assert stdenv.system == "x86_64-linux"; stdenv.mkDerivation { name = "nodegit-${version}-node-v51"; -- cgit v1.2.3 From e13be120a535969d8975be993fb9e35c780094e2 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 21 Jun 2018 10:50:37 +0200 Subject: refact: least fixed point --- clever-tools/default.nix | 55 ++++++++++++++++++++------------------------ nodegit/default.nix | 60 +++++++++++++++++++++++------------------------- 2 files changed, 54 insertions(+), 61 deletions(-) diff --git a/clever-tools/default.nix b/clever-tools/default.nix index 497e911..6c729a5 100644 --- a/clever-tools/default.nix +++ b/clever-tools/default.nix @@ -1,41 +1,36 @@ { stdenv, fetchurl, glibc, nodegit }: -let +stdenv.mkDerivation rec { + name = "clever-tools-${version}"; version = "0.9.3"; - libs = [ stdenv.cc.cc glibc ]; -in + src = fetchurl { + url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; + sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; + }; - stdenv.mkDerivation { - name = "clever-tools-${version}"; + buildInputs = [ nodegit ]; - buildInputs = [ nodegit ]; + libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc glibc ]; - src = fetchurl { - url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; - sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; - }; + nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ]; - libPath = stdenv.lib.makeLibraryPath libs; + 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" + ''; - nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ]; + dontStrip = "true"; - 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" - ''; + preFixup = '' + bin=$out/bin/clever + patchelf \ + --set-rpath "$libPath" \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + "$bin" + ''; - 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/default.nix b/nodegit/default.nix index 83d734a..4bf6dd1 100644 --- a/nodegit/default.nix +++ b/nodegit/default.nix @@ -1,37 +1,35 @@ { stdenv, fetchurl, curl, glibc, openssl }: -let +assert stdenv.system == "x86_64-linux"; + +stdenv.mkDerivation rec { + name = "nodegit-${version}-node-v51"; version = "0.20.3"; - curlWithGnutls = curl.override { - sslSupport = false; - gnutlsSupport = true; + src = fetchurl { + url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; + sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; }; - libs = [ stdenv.cc.cc curlWithGnutls glibc openssl ]; -in - - assert 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" - ''; - } + libPath = stdenv.lib.makeLibraryPath [ + stdenv.cc.cc + (curl.override { + sslSupport = false; + gnutlsSupport = true; + }) + glibc + openssl + ]; + + 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 From a9e33d6fa32216eb28c190598841df9add60fa1c Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 21 Jun 2018 13:02:08 +0200 Subject: refact: allow pkgs override --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 84ed9be..0c12df8 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -with import {}; +{ pkgs ? import {} }: with pkgs; callPackage ./clever-tools { nodegit = callPackage ./nodegit {}; -- cgit v1.2.3