I am trying something relatively simple but can’t get the syntax to actually work. pkgs.R.textshaping doesn’t work on my M1 mac. First it looks like it is missing the glib dependency. So I wanted to add it using an override. I tried the following:
with import <nixpkgs> {};
{
myProject = stdenv.mkDerivation {
name = "myProject";
version = "1";
buildInputs = with rPackages; [
R
textshaping.override { buildInputs = pkgs.glib }
];
};
}
I have also tried to specify the override outside of the Derivation, but that didn’t work either. Any help would be welcome. I am new to nix but find it super promising!
I use this with nix-shell if that matters. I have also tried to learn how to use flakes, but I am not there yet!
textshaping.override { buildInputs = pkgs.glib } is being parsed as 2 sequential list elements. Put parens around them if you want the whole thing to be a single element. (Also, don’t forget the semicolon after glib!)
There are some higher level problems as well here.
If you want to change buildInputs, you need to use overrideAttrs, not override.
buildInputs needs to be a list.
You presumably want to add to buildInputs, not replace it entirely, so you need to include the old value.
This should be a good bit closer:
with import <nixpkgs> {};
{
myProject = stdenv.mkDerivation {
name = "myProject";
version = "1";
buildInputs = with rPackages; [
R
(textshaping.overrideAttrs (old: { buildInputs = old.buildInputs or [] ++ [ pkgs.glib ]; }))
];
};
}
This is really helpful, thank you! Using your code I get an error that attribute ‘overrideAttrs’ is missing. This seems surprising given the documentation. I have noticed this before.
Hmm, that may be something specific to how R packaging is being done here. I’m not familiar with the R ecosystem specifically, so I’m not sure where to go from there. Hopefully someone else can pick up.