I needed the R package quantreg
but its dependency SparseM
would fail to build on my machine because the linker was failing to find iconv
.
ld: library not found for -liconv
So I peeked at the current HEAD of nixpkgs and it indeed specified iconv as a buildInput. I tried to do the same through an overlay (and many other ways) but I kept getting random type errors
.config/nixpkgs/overlays.nix
:
[
(self: super:
{
rPackages = super.rPackages.override {
SparseM = (super.rPackages.SparseM.overrideDerivation (attrs: { buildInputs = attrs.buildInputs ++ [ self.libiconv ]; }));
};
})
]
the above overlay rises:
error: anonymous function at /nix/store/9bhqkb14ca7rl1a8sfyidlr5yl475iyl-nixpkgs/nixpkgs/pkgs/development/r-modules/default.nix:3:1 called with unexpected argument 'SparseM', at /nix/store/9bhqkb14ca7rl1a8sfyidlr5yl475iyl-nixpkgs/nixpkgs/lib/customisation.nix:69:12
(use '--show-trace' to show detailed location information)
I ended up making it work by manually by adding the keys:
quantreg = lib.optionals stdenv.isDarwin [ pkgs.libiconv ];
SparseM = lib.optionals stdenv.isDarwin [ pkgs.libiconv ];
to packagesWithBuildInputs
in ~/.nix-defexpr/channels/nixpkgs/pkgs/development/r-modules/default.nix
.
This feels quite dirty though so I would prefer if I could get the overlay to work.