Skip to content

bundix doesn't like architecture-specific gems #71

@endgame

Description

@endgame

I am trying to bundix the sorbet typechecker.

Gemfile:

source 'https://rubygems.org'
gem 'sorbet'

default.nix (I use callPackage on this):

{ bundlerApp, lib }:

bundlerApp rec {
  pname = "sorbet";
  gemdir = ./.;
  exes = [ "sorbet" "sorbet-static" ];

  meta = with lib; {
    description = "Static type checker for ruby";
    homepage = "https://sorbet.org";
    license = licenses.asl20;
    maintainers = [ maintainers.endgame ];
    platforms = platforms.unix;
  };
}

Because of #70 , I am trying to generate gemset.nix using bundle update && bundix. Here is what happens:

First, bundler correctly downloads the gem that matches my arch (x86_64-linux):

$ bundle update
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using bundler 2.1.4
Fetching sorbet-static 0.5.5549 (x86_64-linux)
Installing sorbet-static 0.5.5549 (x86_64-linux)
Fetching sorbet 0.5.5549
Installing sorbet 0.5.5549
Bundle updated!
Post-install message from sorbet:

  Thanks for installing Sorbet! To use it in your project, first run:

    bundle exec srb init

  which will get your project ready to use with Sorbet.
  After that whenever you want to typecheck your code, run:

    bundle exec srb tc

  For more docs see: https://sorbet.org/docs/adopting

Then bundix downloads a Darwin gem when constructing gemset.nix?

$ bundix
[4.7 MiB DL]
path is '/nix/store/8ycbkwk3v17azzml1836r9lhjdi6l03b-sorbet-static-0.5.5549-universal-darwin-14.gem'
1vli775jl3zkb39mqj26nwk2y8lzc7hv8h8cs4yilnf6fndzab4p => sorbet-static-0.5.5549-universal-darwin-14.gem
[0.0 MiB DL]
path is '/nix/store/spyfvfppa7z08595vqwsm6p0ya8x1aza-sorbet-0.5.5549.gem'
02c09sh99nk4hhf1k768lz7vq3l759h083n6v1cjkmqha1p8b0a1 => sorbet-0.5.5549.gem

Attempting to build this fails:

$ nix-build -E '(import <nixpkgs> {}).callPackage ./. {}'
these derivations will be built:
  /nix/store/xqpqakw2cpg7hsvm6mm5xib9xrlafkr8-sorbet-static-0.5.5549.gem.drv
  /nix/store/53iklkb8qsf1imbffbvpnwsg2nxpn8qd-ruby2.6.6-sorbet-static-0.5.5549.drv
  /nix/store/qmdhdjnrdhr55xr9gvqgsmdg3hvwzxkp-ruby2.6.6-sorbet-0.5.5549.drv
  /nix/store/gzkav0w1d4axhqwmy843y2f1ci81ja2s-sorbet-0.5.5549.drv
  /nix/store/265y5dnrcaykcajwm0z3s5829agb2pyf-sorbet-0.5.5549.drv
building '/nix/store/xqpqakw2cpg7hsvm6mm5xib9xrlafkr8-sorbet-static-0.5.5549.gem.drv'...

trying https://rubygems.org/gems/sorbet-static-0.5.5549.gem
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403 Forbidden
error: cannot download sorbet-static-0.5.5549.gem from any mirror
builder for '/nix/store/xqpqakw2cpg7hsvm6mm5xib9xrlafkr8-sorbet-static-0.5.5549.gem.drv' failed with exit code 1
cannot build derivation '/nix/store/53iklkb8qsf1imbffbvpnwsg2nxpn8qd-ruby2.6.6-sorbet-static-0.5.5549.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/gzkav0w1d4axhqwmy843y2f1ci81ja2s-sorbet-0.5.5549.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/265y5dnrcaykcajwm0z3s5829agb2pyf-sorbet-0.5.5549.drv': 1 dependencies couldn't be built
error: build of '/nix/store/265y5dnrcaykcajwm0z3s5829agb2pyf-sorbet-0.5.5549.drv' failed

Note that it's trying to download a gem file with no architecture. If you visit the gem page for sorbet-static, you'll see a download link that includes the arch. This seems to be getting lost somewhere. Not sure if that is a bundlerApp bug in nix code, or a problem with the generated gemset.nix. But I'm pretty sure that bundix looking at the Darwin gem when constructing gemset.nix is wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions