[Nix-dev] PatchELF in Bundix's postBuild step

zimbatm zimbatm at zimbatm.com
Thu Dec 1 22:29:27 CET 2016


Yes that's it. There is also a pkgs.defaultGemConfig that contains common
overrides, like injecting libxml for the nokogiri gem. You might want to
merge it with your override (or submit yours to nixpkgs).

On Thu, 1 Dec 2016, 20:51 Maarten Hoogendoorn, <maarten at moretea.nl> wrote:

> OK, I found a solution after taking a longer look at the bundlerEnv
> implementation.
> Each gem is packaged as a separate derivation (which makes complete sense).
> BundlerEnv offers the `gemConfig', in which one can set another
> postInstall step.
>
> In my case, the following snippet works:
>
> with pkgs; (bundlerEnv {
>     name ="ruby-protoc-v3";
>     inherit ruby;
>     gemfile= ./Gemfile;
>     lockfile = ./Gemfile.lock;
>     gemset = ./gemset.nix;
>     gemConfig = {
>       grpc-tools = attr: {
>         postInstall= ''
>           for file in $(find
> $out/lib/ruby/gems/2.3.0/gems/grpc-tools-1.0.1/bin/x86_64-linux -type f
> -executable ); do
>             patchelf --set-interpreter
> ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $file
>           done
>         '';
>       };
>     };
> })
>
> I think that I got confused by the fact that I did not see any symlinks
> during my investigation. I must have missed that somewhere.
>
> - Maarten
>
> 2016-12-01 21:24 GMT+01:00 Maarten Hoogendoorn <maarten at moretea.nl>:
>
> Hi,
>
> I'm trying to build a gem that has vendored a statically compiled program
> (that still depends on /lib64/ld-linux-x86-64.so.2).
>
> I've tried to use patchelf in the postBuild in a bundlerEnv, but it's
> complaining about not having write permissions to $out
>
> I wrote a one-liner to check for .nix files that contained both the words
> bundlerEnv and patchelf, but only the top-level/all-packages.nix matched
> both.
>
> I tried to create another derivation, that pulls all file in from the
> bundlerEnv, and then patches the elf file, but it's resulting in the same
> error message.
>
> A nix-expression that reproduces this error is attached.
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161201/92f9ab20/attachment.html>


More information about the nix-dev mailing list