From 1cdc12ed781d17fc79275e1cabed9e613fd5bb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:00:47 +0200 Subject: Ignore vim temp files --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ee84da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.sw* -- cgit v1.2.3 From 7c2a7868b387ffd064dd14c51f7b18224cdc5c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:04:58 +0200 Subject: 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" + ''; + } -- cgit v1.2.3 From 2b21c2dff9c044ccdfcc578bc8d62866f87ecef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:26:17 +0200 Subject: Example Nix expression to use this --- example.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 example.nix diff --git a/example.nix b/example.nix new file mode 100644 index 0000000..1245fec --- /dev/null +++ b/example.nix @@ -0,0 +1,11 @@ +{ pkgs ? import {} }: + +let + clever-tools = pkgs.fetchFromGitHub + { owner = "fmenou"; + repo = "clever-tools-nix"; + rev = "7c2a7868b387ffd064dd14c51f7b18224cdc5c88"; + sha256 = "0r4bc4k90xpq325djvsyix9a6hiabmd4nba14j0plgdrwgzb36rh"; + }; + +in import clever-tools { inherit pkgs; } -- cgit v1.2.3 From c7cb5f23dc24c9df340ff0a70c759bafebac8f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:48:03 +0200 Subject: Update README for good measure --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 1dd270b..3e0c1bb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # clever-tools-nix + Nix derivation to install clever-tools - see https://github.com/CleverCloud/clever-tools + +## What's in it + +2 derivations to install +- nodegit.node 0.20.3 for node v51, from prebuilt archive +- clever-tools 0.9.3, from prebuilt archive + +Main job of those derivations is to use patchelf to make it nix compliant. + +## How to use it + +```nix +{ pkgs ? import {} }: + +let + clever-tools = pkgs.fetchFromGitHub + { owner = "fmenou"; + repo = "clever-tools-nix"; + rev = "7c2a7868b387ffd064dd14c51f7b18224cdc5c88"; + sha256 = "0r4bc4k90xpq325djvsyix9a6hiabmd4nba14j0plgdrwgzb36rh"; + }; + +in import clever-tools { inherit pkgs; } +``` -- cgit v1.2.3 From 008054d5b47962d01e6c9bd7168b229b9c74b4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 00:51:05 +0200 Subject: Build on Travis --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3ccf15c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +--- +language: nix + +notifications: + slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB -- cgit v1.2.3 From 9641e7282f87068d49f9548edb7e3a9deccbaf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 11:33:19 +0200 Subject: Check built version --- .travis.yml | 4 ++++ check.sh | 1 + 2 files changed, 5 insertions(+) create mode 100755 check.sh diff --git a/.travis.yml b/.travis.yml index 3ccf15c..9f457c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ --- language: nix +script: + - nix-env -i -f default.nix + - ./check.sh . + notifications: slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..1b14239 --- /dev/null +++ b/check.sh @@ -0,0 +1 @@ +[ "$(clever --version)" == "0.9.3" ] -- cgit v1.2.3 From b9ee14cc97154e8f9d2f0cc5b464afaeca8aff6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 16:21:00 +0200 Subject: Make derivation names consistent --- default.nix | 2 +- nodegit.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 65c872a..3d380d0 100644 --- a/default.nix +++ b/default.nix @@ -12,7 +12,7 @@ let in stdenv.mkDerivation { - name = "clever-cli-${version}"; + name = "clever-tools-${version}"; buildInputs = [ nodegit nodejs-6_x ]; diff --git a/nodegit.nix b/nodegit.nix index 09f0969..8e898ff 100644 --- a/nodegit.nix +++ b/nodegit.nix @@ -20,7 +20,7 @@ in assert pkgs.stdenv.system == "x86_64-linux"; stdenv.mkDerivation { - name = "nodegit-${version}"; + name = "nodegit-${version}-node-v51"; src = fetchurl { url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; -- cgit v1.2.3 From 4188992a09076b04b19e53774b6b45c14f245f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 16:22:24 +0200 Subject: Remove dead arguments --- default.nix | 2 -- nodegit.nix | 2 -- 2 files changed, 4 deletions(-) diff --git a/default.nix b/default.nix index 3d380d0..3b2519f 100644 --- a/default.nix +++ b/default.nix @@ -21,8 +21,6 @@ in sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; }; - buildPhase = ":"; - libPath = stdenv.lib.makeLibraryPath libs; nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ]; diff --git a/nodegit.nix b/nodegit.nix index 8e898ff..aee9fcf 100644 --- a/nodegit.nix +++ b/nodegit.nix @@ -27,8 +27,6 @@ in sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; }; - buildPhase = ":"; - libPath = stdenv.lib.makeLibraryPath libs; installPhase = '' -- cgit v1.2.3 From 47c9bfd3f08b3ca7590dbfc3e0b99b83fb6012b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Wed, 20 Jun 2018 17:10:58 +0200 Subject: No need to explictly depend on node6 --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 3b2519f..9374e08 100644 --- a/default.nix +++ b/default.nix @@ -14,7 +14,7 @@ in stdenv.mkDerivation { name = "clever-tools-${version}"; - buildInputs = [ nodegit nodejs-6_x ]; + buildInputs = [ nodegit ]; src = fetchurl { url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; -- cgit v1.2.3