diff options
author | Hussein Ait-Lahcen <hussein.aitlahcen@gmail.com> | 2018-06-21 13:30:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-21 13:30:14 +0200 |
commit | 1838266541adbdea6e58e86324d85af0616dfda8 (patch) | |
tree | fc05179b26c9646ce5859c507172380cb4dc273c | |
parent | b02cae1acd4abde5cef50aa039226ac98dc27adf (diff) | |
parent | a9e33d6fa32216eb28c190598841df9add60fa1c (diff) | |
download | clever-tools-nix-1838266541adbdea6e58e86324d85af0616dfda8.tar.gz clever-tools-nix-1838266541adbdea6e58e86324d85af0616dfda8.tar.zst clever-tools-nix-1838266541adbdea6e58e86324d85af0616dfda8.zip |
Merge pull request #2 from hussein-aitlahcen/reusable
architecture refactoring
-rw-r--r-- | clever-tools/default.nix | 36 | ||||
-rw-r--r-- | default.nix | 49 | ||||
-rw-r--r-- | nodegit.nix | 43 | ||||
-rw-r--r-- | nodegit/default.nix | 35 |
4 files changed, 75 insertions, 88 deletions
diff --git a/clever-tools/default.nix b/clever-tools/default.nix new file mode 100644 index 0000000..6c729a5 --- /dev/null +++ b/clever-tools/default.nix | |||
@@ -0,0 +1,36 @@ | |||
1 | { stdenv, fetchurl, glibc, nodegit }: | ||
2 | |||
3 | stdenv.mkDerivation rec { | ||
4 | name = "clever-tools-${version}"; | ||
5 | version = "0.9.3"; | ||
6 | |||
7 | src = fetchurl { | ||
8 | url = "https://clever-tools.cellar.services.clever-cloud.com/releases/${version}/clever-tools-${version}_linux.tar.gz"; | ||
9 | sha256 = "adcae5af912dcbdc74d996b6e94767f24d16bf1bdcd5073797f999fe75b018a4"; | ||
10 | }; | ||
11 | |||
12 | buildInputs = [ nodegit ]; | ||
13 | |||
14 | libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc glibc ]; | ||
15 | |||
16 | nodegitLibrary = stdenv.lib.makeLibraryPath [ nodegit ]; | ||
17 | |||
18 | installPhase = '' | ||
19 | tar --extract --file=$src linux/clever --transform 's/linux\///' | ||
20 | bin=$out/bin/clever | ||
21 | mkdir -p $out/bin | ||
22 | mv clever $bin | ||
23 | ln -s "$nodegitLibrary/nodegit.node" "$out/bin/nodegit.node" | ||
24 | ''; | ||
25 | |||
26 | dontStrip = "true"; | ||
27 | |||
28 | preFixup = '' | ||
29 | bin=$out/bin/clever | ||
30 | patchelf \ | ||
31 | --set-rpath "$libPath" \ | ||
32 | --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | ||
33 | "$bin" | ||
34 | ''; | ||
35 | |||
36 | } | ||
diff --git a/default.nix b/default.nix index 9374e08..0c12df8 100644 --- a/default.nix +++ b/default.nix | |||
@@ -1,46 +1,5 @@ | |||
1 | { pkgs ? import <nixpkgs> {} }: | 1 | { pkgs ? import <nixpkgs> {} }: with pkgs; |
2 | 2 | ||
3 | with pkgs; | 3 | callPackage ./clever-tools { |
4 | 4 | nodegit = callPackage ./nodegit {}; | |
5 | let | 5 | } |
6 | version = "0.9.3"; | ||
7 | |||
8 | nodegit = import ./nodegit.nix { inherit pkgs; }; | ||
9 | |||
10 | libs = [ stdenv.cc.cc glibc ]; | ||
11 | |||
12 | in | ||
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/nodegit.nix b/nodegit.nix deleted file mode 100644 index aee9fcf..0000000 --- a/nodegit.nix +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | { pkgs }: | ||
2 | |||
3 | let | ||
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 | |||
18 | in | ||
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 | } | ||
diff --git a/nodegit/default.nix b/nodegit/default.nix new file mode 100644 index 0000000..4bf6dd1 --- /dev/null +++ b/nodegit/default.nix | |||
@@ -0,0 +1,35 @@ | |||
1 | { stdenv, fetchurl, curl, glibc, openssl }: | ||
2 | |||
3 | assert stdenv.system == "x86_64-linux"; | ||
4 | |||
5 | stdenv.mkDerivation rec { | ||
6 | name = "nodegit-${version}-node-v51"; | ||
7 | version = "0.20.3"; | ||
8 | |||
9 | src = fetchurl { | ||
10 | url = "https://nodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v${version}-node-v51-linux-x64.tar.gz"; | ||
11 | sha256 = "d022a88e58fa70f78b59b475fa6ecc6724d372a779b132264cf571f71bc50020"; | ||
12 | }; | ||
13 | |||
14 | libPath = stdenv.lib.makeLibraryPath [ | ||
15 | stdenv.cc.cc | ||
16 | (curl.override { | ||
17 | sslSupport = false; | ||
18 | gnutlsSupport = true; | ||
19 | }) | ||
20 | glibc | ||
21 | openssl | ||
22 | ]; | ||
23 | |||
24 | installPhase = '' | ||
25 | tar --extract --file=$src Release/nodegit.node --transform 's/Release\//linux-/' | ||
26 | lib=$out/lib/nodegit.node | ||
27 | mkdir -p $out/lib | ||
28 | mv linux-nodegit.node $lib | ||
29 | ''; | ||
30 | |||
31 | preFixup = '' | ||
32 | lib=$out/lib/nodegit.node | ||
33 | patchelf --set-rpath "$libPath" "$lib" | ||
34 | ''; | ||
35 | } | ||