Overriding a dependency of a package

Here’s how I would approach it. It does require rebuilding tensorflow since the input changed, which may take a while.

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/3847a2a8595bba68214ac4b7e3da3fc00776989b.tar.gz") {} }:
  
with pkgs;

let
  inherit (lib) optional optionals;
  nodejs = nodejs-14_x;
  erlang = beam.interpreters.erlangR23;
  elixir = beam.packages.erlangR23.elixir;
  h5py-nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/76ed24ceab9ec8b520f977a2803181f0c1d86b4d.tar.gz") {};
in
mkShell {
  buildInputs = with python38Packages; [
    cacert
    nodejs
    elixir
    erlang
    (tensorflow.override {h5py = h5py-nixpkgs.python38Packages.h5py;})
    scikitimage
    inotify-tools
  ];

  shellHook = ''
    export LANG="en_US.UTF-8";
    export LC_TYPE="en_US.UTF-8";
  '';
}

this line imports the version of nixpkgs that contained the derivation for h5py 2.10

  h5py-nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/76ed24ceab9ec8b520f977a2803181f0c1d86b4d.tar.gz") {};

and this tells nix to override the ‘h5py’ function argument to use that older version:

    (tensorflow.override {h5py = h5py-nixpkgs.python38Packages.h5py;})
2 Likes