Hello!

Suppose these packages:

  a = foo b c;
  b = bar c;
  c = baz ...;

What if I want to call ‘overrideDerivation’ for each of them, yet have
each of the overridden packages refer to its overridden friends?

The naive approach fails:

  config.packageOverrides = pkgs: {
    a = pkgs.lib.overrideDerivation pkgs.a ...;
    b = pkgs.lib.overrideDerivation pkgs.b ...;
    c = pkgs.lib.overrideDerivation pkgs.c ...;
  };

The problem here is that the new ‘a’ will refer to the old ‘b’ and ‘c’,
and the new ‘b’ will refer to the old ‘c’.

When everything goes well, the following approach solves the problem:

  config.packageOverrides = pkgs: rec {
    a = pkgs.lib.overrideDerivation (pkgs.a.override { inherit b c; }) ...;
    b = pkgs.lib.overrideDerivation (pkgs.b.override { inherit c; }) ...;
    c = pkgs.lib.overrideDerivation pkgs.c ...;
  };

… at the expense of readability and convenience.

Any better idea?

Thanks,
Ludo’.

_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to