inscapist / ruby-nix

Generates reproducible ruby/bundler app environment with Nix
MIT License
114 stars 5 forks source link

Use autoPatchelfHook in precompiled gems #46

Closed hss-mateus closed 1 month ago

hss-mateus commented 1 month ago

Some precompiled gems don't come with a ruby platform version. Since gemConfig for precompiled gems are ignored, this makes it impossible to customize the build process of them.

This PR adds autoPatchelfHook to the buildInputs of those gems by default.

Example scenarios:

inscapist commented 1 month ago

looks good to me. thanks for the PR!

antoineco commented 1 month ago

For information the derivation for the ffi gem no longer builds since this change:

Gemset for reproduction:

# gemset.nix
{
  ffi = {
    groups = ["default" "jekyll_plugins"];
    platforms = [];
    source = null;
    targets = [{
      remotes = ["https://rubygems.org"];
      sha256 = "029i2b8plhcdfk8s9agachpy3sxszvd6cyvns8i0m1bs7m5vh6pk";
      target = "aarch64-linux-musl";
      targetCPU = "aarch64";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "04hdrlzyri00lgwi4rh8vzy8z8x789p5gc45sk344ib1fr78g730";
      target = "arm64-darwin";
      targetCPU = "arm64";
      targetOS = "darwin";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "0msqfinz820zbzqwdrr0hzwfdqazwgyssgpi08q2d10wf3s5nfxf";
      target = "arm-linux-gnu";
      targetCPU = "arm";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "0szml3n6ql6wzl5fq2rcl1w9iksz4zb68p7cbbwkwc5kkp34ikgx";
      target = "x86_64-darwin";
      targetCPU = "x86_64";
      targetOS = "darwin";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "0xz8jnrvsg0yh4ybg6r7l2y62sr3qir5nhwaixk1dpgqxng2jwv5";
      target = "x86_64-linux-musl";
      targetCPU = "x86_64";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "1621lgx1isrwjj4j27lvlxjfd6v3pnq2ahvhn2y6pp8rb6fya58h";
      target = "x86_64-linux-gnu";
      targetCPU = "x86_64";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "1df86fkfa5mpr1cqp1n0ylm281gxi2sacvfndgnbiqib74j0vf41";
      target = "x86-linux-gnu";
      targetCPU = "x86";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "1hf8k6bwxd1zsp0wa32dl8bs8z4xmab9dgvan7wxp04bj87c25v9";
      target = "x86-linux-musl";
      targetCPU = "x86";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "1hgj2971w112gp4wkciqh57gfrfafmd1252lqwqql0bbksvqz312";
      target = "aarch64-linux-gnu";
      targetCPU = "aarch64";
      targetOS = "linux";
      type = "gem";
    } {
      remotes = ["https://rubygems.org"];
      sha256 = "1j8gyhbxp3bsz90w8hyvcsd5qqilw6br0r09s8pvdpz22x4ci7bg";
      target = "arm-linux-musl";
      targetCPU = "arm";
      targetOS = "linux";
      type = "gem";
    }];
    version = "1.17.0";
  };
}