aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--.travis.yml9
-rw-r--r--README.md25
-rwxr-xr-xcheck.sh1
-rw-r--r--default.nix46
-rw-r--r--example.nix11
-rw-r--r--nodegit.nix43
7 files changed, 137 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92d225d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
1*.sw*
2result
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..9f457c4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,9 @@
1---
2language: nix
3
4script:
5 - nix-env -i -f default.nix
6 - ./check.sh .
7
8notifications:
9 slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB
diff --git a/README.md b/README.md
index 1dd270b..3e0c1bb 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,27 @@
1# clever-tools-nix 1# clever-tools-nix
2
2Nix derivation to install clever-tools - see https://github.com/CleverCloud/clever-tools 3Nix derivation to install clever-tools - see https://github.com/CleverCloud/clever-tools
4
5## What's in it
6
72 derivations to install
8- nodegit.node 0.20.3 for node v51, from prebuilt archive
9- clever-tools 0.9.3, from prebuilt archive
10
11Main job of those derivations is to use patchelf to make it nix compliant.
12
13## How to use it
14
15```nix
16{ pkgs ? import <nixpkgs> {} }:
17
18let
19 clever-tools = pkgs.fetchFromGitHub
20 { owner = "fmenou";
21 repo = "clever-tools-nix";
22 rev = "7c2a7868b387ffd064dd14c51f7b18224cdc5c88";
23 sha256 = "0r4bc4k90xpq325djvsyix9a6hiabmd4nba14j0plgdrwgzb36rh";
24 };
25
26in import clever-tools { inherit pkgs; }
27```
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" ]
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..9374e08
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,46 @@
1{ pkgs ? import <nixpkgs> {} }:
2
3with pkgs;
4
5let
6 version = "0.9.3";
7
8 nodegit = import ./nodegit.nix { inherit pkgs; };
9
10 libs = [ stdenv.cc.cc glibc ];
11
12in
13
14 stdenv.mkDerivation {
15 name = "clever-tools-${version}";
16
17 buildInputs = [ nodegit ];
18
19 src = fetchurl {
20 url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz";
21 sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4";
22 };
23
24 libPath = stdenv.lib.makeLibraryPath libs;
25
26 nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ];
27
28 installPhase = ''
29 tar --extract --file=$src linux/clever --transform 's/linux\///'
30 bin=$out/bin/clever
31 mkdir -p $out/bin
32 mv clever $bin
33 ln -s "$nodegitLibrary/nodegit.node" "$out/bin/nodegit.node"
34 '';
35
36 dontStrip = "true";
37
38 preFixup = ''
39 bin=$out/bin/clever
40 patchelf \
41 --set-rpath "$libPath" \
42 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
43 "$bin"
44 '';
45
46 }
diff --git a/example.nix b/example.nix
new file mode 100644
index 0000000..1245fec
--- /dev/null
+++ b/example.nix
@@ -0,0 +1,11 @@
1{ pkgs ? import <nixpkgs> {} }:
2
3let
4 clever-tools = pkgs.fetchFromGitHub
5 { owner = "fmenou";
6 repo = "clever-tools-nix";
7 rev = "7c2a7868b387ffd064dd14c51f7b18224cdc5c88";
8 sha256 = "0r4bc4k90xpq325djvsyix9a6hiabmd4nba14j0plgdrwgzb36rh";
9 };
10
11in import clever-tools { inherit pkgs; }
diff --git a/nodegit.nix b/nodegit.nix
new file mode 100644
index 0000000..aee9fcf
--- /dev/null
+++ b/nodegit.nix
@@ -0,0 +1,43 @@
1{ pkgs }:
2
3let
4 version = "0.20.3";
5
6 stdenv = pkgs.stdenv;
7 fetchurl = pkgs.fetchurl;
8
9 curl = pkgs.curl.override {
10 sslSupport = false;
11 gnutlsSupport = true;
12 };
13 glibc = pkgs.glibc;
14 openssl = pkgs.openssl;
15
16 libs = [ stdenv.cc.cc curl glibc openssl ];
17
18in
19
20 assert pkgs.stdenv.system == "x86_64-linux";
21
22 stdenv.mkDerivation {
23 name = "nodegit-${version}-node-v51";
24
25 src = fetchurl {
26 url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz";
27 sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020";
28 };
29
30 libPath = stdenv.lib.makeLibraryPath libs;
31
32 installPhase = ''
33 tar --extract --file=$src Release/nodegit.node --transform 's/Release\//linux-/'
34 lib=$out/lib/nodegit.node
35 mkdir -p $out/lib
36 mv linux-nodegit.node $lib
37 '';
38
39 preFixup = ''
40 lib=$out/lib/nodegit.node
41 patchelf --set-rpath "$libPath" "$lib"
42 '';
43 }