diff options
author | Mario Rodas <marsam@users.noreply.github.com> | 2023-03-11 18:57:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 18:57:59 -0500 |
commit | 8b6900dc2ff916fe0c8b6ed250f1ef55d9962bb2 (patch) | |
tree | e126f476ce855450c32864dc2b47aa9ab90a0a9f /pkgs/development/ruby-modules | |
parent | 8a9d0df6314abd8ae28739e1a501b7e0ae5dbab1 (diff) | |
parent | baf1f1293b289ce53d9b660465cd68e1a3e00b96 (diff) |
Merge pull request #210228 from amarshall/ruby-makebinarywrapper
ruby: Fix withPackages on darwin with makeBinaryWrapper
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r-- | pkgs/development/ruby-modules/with-packages/default.nix | 6 | ||||
-rw-r--r-- | pkgs/development/ruby-modules/with-packages/test.nix | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/development/ruby-modules/with-packages/default.nix b/pkgs/development/ruby-modules/with-packages/default.nix index 5be820b60e300..31573bce499fc 100644 --- a/pkgs/development/ruby-modules/with-packages/default.nix +++ b/pkgs/development/ruby-modules/with-packages/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, buildEnv, buildRubyGem, ruby, gemConfig, makeWrapper }: +{ stdenv, lib, buildEnv, buildRubyGem, ruby, gemConfig, makeBinaryWrapper }: /* Example usage: @@ -43,7 +43,7 @@ let wrappedRuby = stdenv.mkDerivation { name = "wrapped-${ruby.name}"; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeBinaryWrapper ]; buildCommand = '' mkdir -p $out/bin for i in ${ruby}/bin/*; do @@ -54,7 +54,7 @@ let in stdenv.mkDerivation { name = "${ruby.name}-with-packages"; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeBinaryWrapper ]; buildInputs = [ selected ruby ]; dontUnpack = true; diff --git a/pkgs/development/ruby-modules/with-packages/test.nix b/pkgs/development/ruby-modules/with-packages/test.nix index ca2934b6f61c9..be652747c4699 100644 --- a/pkgs/development/ruby-modules/with-packages/test.nix +++ b/pkgs/development/ruby-modules/with-packages/test.nix @@ -15,6 +15,22 @@ let pkgs.ruby.gems) // (import ./require_exceptions.nix); + testWrapper = ruby: stdenv.mkDerivation { + name = "test-wrappedRuby-${ruby.name}"; + buildInputs = [ ((ruby.withPackages (ps: [ ])).wrappedRuby) ]; + buildCommand = '' + cat <<'EOF' > test-ruby + #!/usr/bin/env ruby + puts RUBY_VERSION + EOF + + chmod +x test-ruby + patchShebangs test-ruby + [[ $(./test-ruby) = $(${ruby}/bin/ruby test-ruby) ]] + touch $out + ''; + }; + tests = ruby: lib.mapAttrs (name: gem: let @@ -39,7 +55,7 @@ let in stdenv.mkDerivation { name = "test-all-ruby-gems"; - buildInputs = builtins.foldl' (sum: ruby: sum ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions; + buildInputs = builtins.foldl' (sum: ruby: sum ++ [ (testWrapper ruby) ] ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions; buildCommand = '' touch $out ''; |