diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-08-04 10:43:07 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-08-04 10:43:07 +0000 |
commit | 62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch) | |
tree | c2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/ruby-modules/gem | |
parent | d9c82ed3044c72cecf01c6ea042489d30914577c (diff) | |
parent | e24069138dfec3ef94f211f1da005bb5395adc11 (diff) | |
download | nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2 nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip |
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/ruby-modules/gem')
-rw-r--r-- | pkgs/development/ruby-modules/gem/default.nix | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix index 158d5891ec3..7ba8c70a980 100644 --- a/pkgs/development/ruby-modules/gem/default.nix +++ b/pkgs/development/ruby-modules/gem/default.nix @@ -18,7 +18,7 @@ # Normal gem packages can be used outside of bundler; a binstub is created in # $out/bin. -{ lib, fetchurl, fetchgit, makeWrapper, git, darwin +{ lib, fetchurl, fetchgit, makeWrapper, gitMinimal, darwin , ruby, bundler } @ defs: @@ -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 @@ -84,7 +89,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { buildInputs = [ ruby makeWrapper - ] ++ lib.optionals (type == "git") [ git ] + ] ++ lib.optionals (type == "git") [ gitMinimal ] ++ lib.optionals (type != "gem") [ bundler ] ++ lib.optional stdenv.isDarwin darwin.libobjc ++ buildInputs; @@ -124,6 +129,12 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { runHook postUnpack ''; + # As of ruby 3.0, ruby headers require -fdeclspec when building with clang + # Introduced in https://github.com/ruby/ruby/commit/0958e19ffb047781fe1506760c7cbd8d7fe74e57 + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3") [ + "-fdeclspec" + ]; + buildPhase = attrs.buildPhase or '' runHook preBuild @@ -206,9 +217,9 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { # looks like useless files which break build repeatability and consume space pushd $out/${ruby.gemPath} - rm -fv doc/*/*/created.rid || true - rm -fv {gems/*/ext/*,extensions/*/*/*}/{mkmf.log,gem_make.out} || true - rm -fvr cache + find doc/ -iname created.rid -delete -print + find gems/*/ext/ extensions/ \( -iname Makefile -o -iname mkmf.log -o -iname gem_make.out \) -delete -print + ${if keepGemCache then "" else "rm -fvr cache"} popd # write out metadata and binstubs @@ -231,7 +242,10 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { propagatedUserEnvPkgs = gemPath ++ propagatedUserEnvPkgs; passthru = passthru // { isRubyGem = true; }; - inherit meta; + meta = { + # default to Ruby's platforms + platforms = ruby.meta.platforms; + } // meta; }) ) |