Recommended Approach to Installing Ruby Gems?

What is the recommended approach to installing ruby gems (like statelint and asciidoctor-pdf via Nix (with Home Manager and Flakes)?

I tried using “withPackages” but that didn’t work with the aforementioned gems. For reference, below is my truncated home.nix file.

{ config, pkgs, ... }:

let
  lua = pkgs.lua5_3;
  luaPkgs = lua.withPackages (p: with p; [ fennel readline ]);
  py = pkgs.python310;
  pyPkgs = py.withPackages
    (p: with p; [ black ipython jupyterlab matplotlib numpy pandas seaborn ]);
  rb = pkgs.ruby_3_1;
in {
  home.packages = with pkgs; [
   luaPkgs
   pyPkgs
   ...
   ];
}
2 Likes

I like to use bundix because it integrates nicely with existing Gemfiles.