HTTP request failing via Bundler but not curl

Hi, I’m trying to deploy a Rails application on NixOS, but I’m not able to install any dependencies because bundle install fails with this error:

$ bundle --verbose
Running `bundle install --verbose` with bundler 2.1.4
Found changes from the lockfile, re-resolving dependencies because bundler is unlocking ruby: (version, 2.6.6, 2.7.1)
HTTP GET https://index.rubygems.org/versions
Net::OpenTimeout: execution expired
/nix/store/3dxk4kx37c2bs0ayy290va7zr4hpl02b-ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:947:in `initialize'
  /nix/store/3dxk4kx37c2bs0ayy290va7zr4hpl02b-ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:947:in `open'
  /nix/store/3dxk4kx37c2bs0ayy290va7zr4hpl02b-ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:947:in `block in connect'
  /nix/store/3dxk4kx37c2bs0ayy290va7zr4hpl02b-ruby-2.6.6/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
  …

However, using curl to request that same URL works fine:

$ curl https://index.rubygems.org/versions | wc -l
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.7M  100 14.7M    0     0  39.1M      0 --:--:-- --:--:-- --:--:-- 39.1M
166327

My shell.nix looks like this:

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = "app";
  buildInputs = [
    ruby.devEnv

    bundix
    git
    gnumake
    nodejs
    postgresql

    curl
  ];
}

Does anybody know what the problem might be? I’ve looked at the examples for Ruby applications on NixOS and I’m not seeing anything special to enable Bundler to work correctly.