A quick example about how to use the library function remove to adjust a package's dependencies based on a given condition.

Usage example

While working on improvements of my Nix based setup of RhodeCode Enterprise CE I ended up with a need to remove a dependency based on the current target system. In the end I found the function remove inside of the library of Nixpkgs.

Here is an excerpt of the usage:

ipython = super.ipython.override (attrs: {
  propagatedBuildInputs =
    if (! pkgs.stdenv.isDarwin)
    then pkgs.lib.remove self.appnope attrs.propagatedBuildInputs
    else attrs.propagatedBuildInputs;

The full context can be found in the following commit: https://github.com/johbo/nix-rhodecode/commit/6a46a950188679ac8a0f33d9eee5f8c6cb7bbcbd


comments powered by Disqus