From 96ea4f91951010ef9c560c13122a6f8ebfac2816 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 21 Jun 2018 10:44:11 +0200 Subject: [PATCH] refact: 1-1 folder-package --- clever-tools/default.nix | 46 +++++++++++++++++++++++++++++ default.nix | 47 ++---------------------------- nodegit.nix => nodegit/default.nix | 0 3 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 clever-tools/default.nix rename nodegit.nix => nodegit/default.nix (100%) 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/default.nix similarity index 100% rename from nodegit.nix rename to nodegit/default.nix -- 2.41.0