[Bug]: `devbox add ruby` fails with older version of nixpkgs

This issue has been tracked since 2023-01-18.

Current Behavior (bug)

  1. Set your nixpkgs hash to a previous one. In this particular case trying to set to a hash that would install ruby 2.6.6. Here is the devbox.json:
{
  "packages": [],
  "shell": {
    "init_hook": null
  },
  "nixpkgs": {
    "commit": "c92ca95afb5043bc6faa0d526460584eccff2277"
  }
}
  1. Run devbox add ruby. You get this output:
devbox add ruby

Error: ruby: package not found

To search for packages use https://search.nixos.org/packages

Expected Behavior (fix)
Instead, ruby should install correctly. Here's the output when using a recent nixpkgs hash:

devbox add ruby
Installing nix packages. This may take a while... done.

This plugin sets the following environment variables:
* RUBY_CONFDIR=/Users/daniel/Code/playground/repro-devbox/.devbox/virtenv/ruby
* GEMRC=/Users/daniel/Code/playground/repro-devbox/.devbox/virtenv/ruby/.gemrc
* GEM_HOME=/Users/daniel/Code/playground/repro-devbox/.devbox/virtenv/ruby

To show this information, run `devbox info ruby`

ruby (ruby-2.7.6) is now installed.

Additional context

devbox version -v
Version:     0.2.2
Platform:    darwin_arm64
Commit:      c7d47b13f9b749f0ae5c9b29edbbb4be16b6cca6
Commit Time: 2023-01-13T19:04:12Z
Go Version:  go1.19.4
ipince wrote this answer on 2023-01-20

FWIW, looks like the ruby pkg is indeed defined in the nixpkgs repo at that commit, and it's in the same path/location as it is today:
https://github.com/NixOS/nixpkgs/blob/c92ca95afb5043bc6faa0d526460584eccff2277/pkgs/development/interpreters/ruby/default.nix

ipince wrote this answer on 2023-01-20

Does devbox support any commit, no matter how far back in history it is? It looks like there's been roughly 160k commits since c92ca9

savil wrote this answer on 2023-01-20

this appears to be a limitation of M1 macs. In contrast, when I try with my intel mac it does work fine...

loreto wrote this answer on 2023-01-20

The working hypothesis is:

  • This particular commit is from before M1s even existed
  • As a result the evaluated nix expression does not contain the attribute legacyPackages.aarch64-darwin but it does contain legacyPackages.x86_64-darwin
  • On an M1/M2 nix is therefore unable to find anything.

In fact, running nix directly on an M1 returns:

nix search --extra-experimental-features "nix-command flakes" nixpkgs/c92ca95afb5043bc6faa0d526460584eccff2277#ruby
error: no results for the given search term(s)!

On an intel it returns:

❯ nix search --extra-experimental-features "nix-command flakes" nixpkgs/c92ca95afb5043bc6faa0d526460584eccff2277#ruby
* legacyPackages.x86_64-darwin.ruby (2.6.6)
  The Ruby language
loreto wrote this answer on 2023-01-27

Closing as this is really caused by nix not having the package defined instead of behavior on our end.

More Details About Repo
Owner Name jetpack-io
Repo Name devbox
Full Name jetpack-io/devbox
Language Go
Created Date 2022-08-18
Updated Date 2023-03-31
Star Count 4960
Watcher Count 19
Fork Count 68
Issue Count 42

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date