dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

Language request: Ruby

Open anna328p opened this issue 3 years ago • 5 comments

ruby's package ecosystem has two parts: a package manager (gem) and a dependency manager (bundler).

gem is a system for defining and building packages, and rubygems is the main distribution server for these packages. nixpkgs has infrastructure to build gems, though it's not very refined. there's a big file with a list of gems to be included in nixpkgs, and all of their versions are bumped simultaneously every so often (rarely).

bundler is similar to rust's cargo (cargo was actually written by bundler's authors!) but works in different ways; its lockfiles don't list hashes, for example.

there's a bit of infrastructure to support ruby projects, namely bundix and bundlerEnv. but these projects are undermaintained; bundix runs into many errors with modern versions of ruby and bundler, and needs to be called in obscure sequences of operations and folder deletions to generate anything. it generates invalid, unbuildable derivations in common situations, like two gems separately pulled from the same git repo. and these tools work best with one specific kind of project structure, and everything else requires hacky changes. (example)

anna328p avatar Sep 25 '22 19:09 anna328p

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rubypackages-rails-has-been-removed-from-nix-package-store-starting-22-05/24184/4

nixos-discourse avatar Dec 22 '22 10:12 nixos-discourse

This will be a bit hard to do cleanly in dream2nix due to the structure of Gemfile.lock. Unlike the lock files from for instance nodejs, these lock files do not include urls nor hashes of the files that were fetched. There is an open issue for bundler covering this for possible future work that may happen on the lock file: https://github.com/rubygems/rubygems/issues/3379

bobvanderlinden avatar Dec 22 '22 20:12 bobvanderlinden

dream2nix supports input that doesn't have URLs and hashes. We just need to create a program that calculates them. This is called impure translator in dream2nix. The result will be a dream-lock.json file that is added to the repo.

DavHau avatar Dec 23 '22 04:12 DavHau

@DavHau @bobvanderlinden bundler 2.6 was released with the required feature

h0nIg avatar Dec 25 '24 18:12 h0nIg

Everyone who ist interested in a IFD solution: https://github.com/NixOS/nixpkgs/issues/372597#issuecomment-2656250943

h0nIg avatar Mar 03 '25 22:03 h0nIg

Edited the issue body, fixed links and updated old information to account for the current state of the ecosystem, especially the fact that Bundler lockfiles now contain hashes.

anna328p avatar Nov 12 '25 22:11 anna328p