Comments (7)
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.
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.
Aha... but it breaks when adding new gems to the Gemfile. Ok, that seems like a bundix
bug.
from rails-nix.
Yeah - probably not hard to fix.
from rails-nix.
Hmmm okay, I've had a bit more success by passing the ruby package to bundix. This works:
- Add a new gem
- Install it locally with
bundle install
- run
bundix -l --ruby ruby_3_0
(referencing the Ruby nix package name)
from rails-nix.
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.
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)
- Increase the layer count HOT 2
- Setup a machine VM for running Nix builds HOT 1
- Javascript dependencies HOT 2
- Custom Ruby / Bundler versions HOT 5
- Extract nix code to be reusable HOT 1
- Gems are rebuilt on gemdir input change HOT 3
- Extend Rails documentation to include Sidekiq and multiprocess apps HOT 1
- Write a basic documentation page for launching Rails apps
- Ensure nix-shell is usable and useful HOT 2
- Make assets pre-compilation a discrete cacheable build and layer HOT 3
- grpc gem build failure HOT 8
- nixpkgs 21.11 is missing an important coreutils patch HOT 2
- Choosing a strategy for changing nixpkgs versions HOT 4
- Add examples for all configurable options in rails-nix/default.nix HOT 1
- Work out how to reduce the image size HOT 2
- Try strategies to reduce closure sizes in an ad-hoc manner HOT 1
- Update the `pg` gem in Nixpkgs to depend on `postgresql.lib` to reduce the closure size HOT 2
- Look at strategies to separate runtime vs. app in containerization layers
- Skip inclusion of gems in the development/test groups HOT 4
- Customize the layering strategy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails-nix.