bobvanderlinden / nixpkgs-ruby

A Nix repository with all Ruby versions being kept up-to-date automatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Advice on overriding openssl version?

will opened this issue · comments

This is maybe related to #6, but I didn't want to hijack the discussion there.

I need to drop back down to openssl 1.1 for the time being. So far I've figured out two ways to do it. First was to make a branch on my fork of this project and change the override predicate to always return true. This was easy, but for sure not the right way.

I finally figured one way to do it with overrideAttrs, but it's feels kind of gross to need to use lists.remove

ruby = nixpkgs-ruby.packages.${system}."ruby-${rubyVersion}".overrideAttrs (finalAttrs: previousAttrs: {
  buildInputs = pkgs.lib.lists.remove pkgs.openssl (previousAttrs.buildInputs ++ [ pkgs.openssl_1_1 ]);
});

rubyEnv = pkgs.bundlerEnv {
  inherit ruby;
  # ...

I have to imagine there is a more proper way to pass in openssl_1_1 since openssl is an argument to packageFn, but I can't figure out where to pass that in.

You should be able to use the following:

nixpkgs-ruby.packages.${system}."ruby-${rubyVersion}".override { openssl = pkgs.openssl_1_1; }

The Ruby packages have several supported package options, which you can set using override. overrideAttrs is only needed when you want to change something in the derivation that isn't supported by those options.

I once wrote a blog post about customizing Nix packages, this section is about override vs overrideAttrs: https://bobvanderlinden.me/customizing-packages-in-nix/#modification-methods

Thanks this worked!