nix-community / dream2nix

Simplified nix packaging for various programming language ecosystems [maintainer=@DavHau]
https://dream2nix.dev
MIT License
1.01k stars 124 forks source link

Language request: Ruby #305

Open anna328p opened 2 years ago

anna328p commented 2 years ago

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)

nixos-discourse commented 1 year ago

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

bobvanderlinden commented 1 year ago

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

DavHau commented 1 year ago

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.