Git Product home page Git Product logo

Comments (7)

Matt-Yorkley avatar Matt-Yorkley commented on August 17, 2024

It seems to build if the versions match? Nix's default Ruby version is 2.7.5. If I set ruby "2.7.5" in the Gemfile, run bundix -l and then nix-build it doesn't complain.

from rails-nix.

Matt-Yorkley avatar Matt-Yorkley commented on August 17, 2024

Likewise with ruby "3.0.3" in the Gemfile, running bundix -l, then setting ruby = pkgs.ruby_3_0 in default.nix... it builds successfully and the app runs with 3.0.3 🎉

from rails-nix.

Matt-Yorkley avatar Matt-Yorkley commented on August 17, 2024

Aha... but it breaks when adding new gems to the Gemfile. Ok, that seems like a bundix bug.

from rails-nix.

jsierles avatar jsierles commented on August 17, 2024

Yeah - probably not hard to fix.

from rails-nix.

Matt-Yorkley avatar Matt-Yorkley commented on August 17, 2024

Hmmm okay, I've had a bit more success by passing the ruby package to bundix. This works:

  1. Add a new gem
  2. Install it locally with bundle install
  3. run bundix -l --ruby ruby_3_0 (referencing the Ruby nix package name)

from rails-nix.

winston0410 avatar winston0410 commented on August 17, 2024

I have this exact issue right now, I have a gemfile like this:

source 'https://rubygems.org'

# security patch pins min versions
gem 'aws-sdk-s3'
gem 'loofah', '>= 2.2.3'
gem 'rack', '>= 2.0.6'

ruby '2.7.1'

And I run bundix like this:

nix-shell -p bundix --run "bundix --init --ruby=ruby_2_7"

And I got error like this:

[nix-shell:~/demo]$ rails
Traceback (most recent call last):
        3: from /nix/store/55rlx3hhr0l4z75qjf8dw40cya6dqjz7-lbh-income-api-bundler-env/bin/rails:19:in `<main>'
        2: from /nix/store/xvaflscg5fh6391lc8dfyrx899iq8frg-bundler-2.3.6/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler.rb:145:in `setup'
        1: from /nix/store/xvaflscg5fh6391lc8dfyrx899iq8frg-bundler-2.3.6/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/definition.rb:401:in `validate_runtime!'
/nix/store/xvaflscg5fh6391lc8dfyrx899iq8frg-bundler-2.3.6/lib/ruby/gems/2.7.0/gems/bundler-2.3.6/lib/bundler/definition.rb:426:in `validate_ruby!': Your Ruby version is 2.7.5, but your Gemfile specified 2.7.1 (Bundler::RubyVersionMismatch)

How can I fix this version error?

from rails-nix.

jsierles avatar jsierles commented on August 17, 2024

For our use case, we can probably ignore this by assuming that bundix is going to be run from a Nix environment defined by an app spec. The spec will be generated by a tool that detects the correct Ruby version from Gemfile and/or .ruby-version.

from rails-nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.