As of my understanding, when a package that depends on another which cannot be changed globally to meet their needs a local override may be done. What I’m calling a local override may be seen here in the imaginary pkgs/by-name/fo/foo/packages.nix
with the bar'
variable:
{ stdenv
, fetchurl
, bar
}: let
bar' = bar.overrideAttrs {
src = fetchurl rec {
version = "0.2.0";
url = "https://bar.org/bar-${version}";
hash = "sha256-<hash>";
};
};
in
stdenv.mkDerivation {
# This does not matter for the point being made
}
In such case, foo
will now work, since an overwritten version of bar
— bar'
— is being used. However, when the user utilizes foo
’s override
function in regards to bar
, any changes to its src
attribute would be ignored, since they are overwritten on the recipe.
So, my questions are:
- Are local overrides to be avoided?
- If so, what should one do if a change must be made to a package’s dependency, but cannot be made to the dependency globally?
- If not, how would one still provide users the ability to override the locally overwritten packages? An use case for this would, for instance, taking the example above, if one uses an
overlay
forfoo
that provides a different version ofbar
.