Automatic bundix in ruby derivation possible?

I have a derivation which bundles a ruby interpreter with a ruby gem I occasionally use to update my mail filters in my home-manager configuration.
One thing I’m missing to understand is how to make it bootstrap as I have to (at least once after creating the ~/.config/nixpkgs/program/ruby-gems/default.nix in my home tree) run

pushd ~/.config/nixpkgs/program/ruby-gems/
${self.pkgs.bundix}/bin/bundix -l
popd

manually to create the gemset.nix and Gemfile.lock files in the gem’s folder.

Can I integrate that command sequence in the derivation itself somehow ?

Derivation being:

# eval in home.nix packages: (import ./program/ruby-gems { inherit lib; inherit bundlerEnv; inherit bundlerUpdateScript; inherit ruby; }).wrappedRuby
{ lib, bundlerEnv, bundlerUpdateScript, ruby }:
bundlerEnv {
  name = "gmail-britta-bundler-env";
  gemdir = ./.;
  ruby = ruby;
  passthru.updateScript = bundlerUpdateScript "gmail-britta-bundler-env";
}