Skip to content

Instantly share code, notes, and snippets.

@aantron
Created May 5, 2020 19:41
Show Gist options
  • Save aantron/701ac7c459fe8e5c4d9588d285117f6d to your computer and use it in GitHub Desktop.
Save aantron/701ac7c459fe8e5c4d9588d285117f6d to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
esy-solve-cudf = stdenv.mkDerivation rec {
name = "esy-solve-cudf-${version}";
version = "0.1.10";
src = fetchurl {
url = "https://registry.npmjs.org/esy-solve-cudf/-/esy-solve-cudf-${version}.tgz";
sha256 = "3cfb233e5536fe555ff1318bcff241481c8dcbe1edc30b5f97e2366134d3f234";
};
# Running patchelf here for a "clean" subpackage causes double patchelf
# application when the binary is installed in for the esy package, which
# fails.
installPhase = ''
install -D platform-linux/esySolveCudfCommand.exe $out/bin/esySolveCudfCommand.exe
install -D package.json $out/package.json
'';
};
in
stdenv.mkDerivation rec {
name = "esy-${version}";
version = "0.6.4";
src = fetchurl {
url = "https://registry.npmjs.org/esy/-/esy-${version}.tgz";
sha256 = "e8053b9bb797c604785cfad69b05d72a5728ca06420c8cc0f490d1b7cb022255";
};
nativeBuildInputs = [
autoPatchelfHook
stdenv.cc.cc
];
installPhase = ''
install -D -m 644 package.json $out/lib/esy/package.json
install -D platform-linux/_build/default/bin/esy.exe $out/lib/esy/_build/default/bin/esy.exe
install -D platform-linux/_build/default/bin/esyInstallRelease.js $out/lib/esy/_build/default/bin/esyInstallRelease.js
install -D platform-linux/_build/default/esy-build-package/bin/esyBuildPackageCommand.exe $out/lib/esy/_build/default/esy-build-package/bin/esyBuildPackageCommand.exe
install -D platform-linux/_build/default/esy-build-package/bin/esyRewritePrefixCommand.exe $out/lib/esy/_build/default/esy-build-package/bin/esyRewritePrefixCommand.exe install -D ${esy-solve-cudf}/package.json $out/lib/esy/node_modules/esy-solve-cudf/package.json
install -D ${esy-solve-cudf}/bin/esySolveCudfCommand.exe $out/lib/esy/node_modules/esy-solve-cudf/esySolveCudfCommand.exe
mkdir -p $out/bin
ln -s $out/lib/esy/_build/default/bin/esy.exe $out/bin/esy
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment