From a3bff35450a046e2a79ebf9baefb4bf090ee3c49 Mon Sep 17 00:00:00 2001 From: Sergei Maximov Date: Fri, 18 Jan 2019 10:37:38 +0300 Subject: [PATCH] gem-config: support rbnacl v6.0.0 With the v6.0.0 release of the `rbnacl` gem, it does not longer depends on `rbnacl-libsodium` gem (which is now deprecated ([1])) to package the `libsodium` library and should use the one provided by the distribution; it raises an error if `rbnacl-libsodium` is detected ([2]). Unfortunately, default gem config patches `rbnacl` unconditionally ([3]), which means that newer versions of `rbnacl` fail at startup. [1]: https://github.com/crypto-rb/rbnacl-libsodium/issues/29 [2]: https://github.com/crypto-rb/rbnacl/blob/c176fc0bd8be74cf62c93a4b122e220ce4895348/lib/rbnacl.rb#L4-L8 [3]: https://github.com/NixOS/nixpkgs/blob/9fd099a6ae1690909ebf40145e4cdabd67179676/pkgs/development/ruby-modules/gem-config/default.nix#L300-L306 --- .../ruby-modules/gem-config/default.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix index 7fdf5c83901..fd841563005 100644 --- a/pkgs/development/ruby-modules/gem-config/default.nix +++ b/pkgs/development/ruby-modules/gem-config/default.nix @@ -297,13 +297,16 @@ in buildInputs = [ rainbow_rake ]; }; - rbnacl = spec: { - postInstall = '' - sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \ - RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}' - " - ''; - }; + rbnacl = spec: + if lib.versionOlder spec.version "6.0.0" then { + postInstall = '' + sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \ + RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}' + " + ''; + } else { + buildInputs = [ libsodium ]; + }; re2 = attrs: { buildInputs = [ re2 ];