diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix index 910949d847c..9e64b120af8 100644 --- a/pkgs/development/ruby-modules/gem/default.nix +++ b/pkgs/development/ruby-modules/gem/default.nix @@ -49,6 +49,11 @@ lib.makeOverridable ( , propagatedUserEnvPkgs ? [] , buildFlags ? [] , passthru ? {} +# bundler expects gems to be stored in the cache directory for certain actions +# such as `bundler install --redownload`. +# At the cost of increasing the store size, you can keep the gems to have closer +# alignment with what Bundler expects. +, keepGemCache ? false , ...} @ attrs: let @@ -208,7 +213,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { pushd $out/${ruby.gemPath} rm -fv doc/*/*/created.rid || true rm -fv {gems/*/ext/*,extensions/*/*/*}/{Makefile,mkmf.log,gem_make.out} || true - rm -fvr cache + ${if keepGemCache then "" else "rm -fvr cache"} popd # write out metadata and binstubs