dream2nix
dream2nix copied to clipboard
Language request: Ruby
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)
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
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
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 @bobvanderlinden bundler 2.6 was released with the required feature
Everyone who ist interested in a IFD solution: https://github.com/NixOS/nixpkgs/issues/372597#issuecomment-2656250943
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.