I want to overlay/override a package, but I want to put a condition based on the package input. Is this possible?
Imagine for the following package:
{
lib,
stdenv,
fetchFromGitHub,
backend ? "default",
}:
assert backend == "default" || backend == "other";
stdenv.mkDerivation (finalAttrs: {
pname = "some-package-${backend}";
version = "5.1.1";
src = fetchFromGitHub {
...
};
meta = {
platforms =
[ "x86_64-linux" "aarch64-linux" ] ++ lib.optionals (backend == "default") [ "x86_64-darwin" ];
};
})
How can I use `overrideAttrs` for this package to add `"“aarch64-darwin””` to `meta.platforms` only if the package input attribute `backend` is equal to `"default”`?