Using home-manager to install a binary ruby gem

I use Home Manager (with flakes) very happily for my dotfiles. I have also installed Ruby and a few Gems like this in my home.nix:

(ruby.withPackages (ps: with ps; [
      nokogiri
      pry
      bundler
    ]))

However, I would like to install Brett Terpstra’s handy howzit gem to use in any directory within my $HOME (howzit is a markdown based alternative to make). In other words, this isn’t a dependency associated with a particular Ruby project, where it would make sense to add it to a Gemfile and then install using bundix.

This gem doesn’t seem to be in the ruby gem packages in nixpkgs, so I can’t just add it to the list above to have it globally available.

What would be the easiest/cleanest way to integrate installing this gem with my home manager setup, and preferably add a symlink for the howzit binary to my ~/.nix-profile/bin/?

Thanks in advance for any help!

You can just add it and run the tooling to update rubyPackages.

@Sandro That sounds good! Can you point me to an example of how to do that? I don’t know how to add a gem and update rubyPackages.

there is a section in the language specific guide https://github.com/NixOS/nixpkgs/blob/f5c0e424fc508619354d0c31d78c81a61b54684c/doc/languages-frameworks/ruby.section.md#adding-a-gem-to-the-default-gemset-adding-a-gem-to-the-default-gemset

Thanks for pointing to that, I’ll read through it carefully, but I seem to have fallen at the first hurdle because I don’t have a /pkgs path. I’m on macOS and using home-manager standalone at the moment (not through nix-darwin).

There seems to be useful info there so I’ll see if I can figure it out.