[Nix-dev] Guarantee Consistent Builds and Obsolete overrideScope
Peter Simons
simons at cryp.to
Thu Oct 29 13:52:13 CET 2015
Hi Felipe,
> In the future it may be possible for one to use two versions of the
> same package at the same time using Backpack. Should this catch on,
> the non-breakable improvement will become a bit inflexible in some
> cases.
yes, that is a good point. Fortunately, build expression that expect a
transitive closure of all dependencies still allow for building binaries
with "inconsistent" library versions -- it just takes a conscious effort
to pull it off. For example:
foo = { binary }: mkDerivation { haskellLibraryDepends = [binary]; ... };
bar = { binary }: mkDerivation { haskellLibraryDepends = [binary]; ... };
foobar = { binary, foo, bar }:
let foo' = foo { inherit binary; };
bar' = bar { inherit binary; };
in
mkDerivation {
haskellLibraryDepends = [foo' bar'];
...
};
Now, we can use 'foobar' as follows:
foobar {
binary = null;
foo = { binary }: self.foo { self.binary_1; };
bar = { binary }: self.bar { self.binary_2; };
};
'foo' and 'bar' simply ignore the argument passed to them. It's not
pretty, and obviously one wouldn't want to do this kind of thing on a
regular basis. The point is, however, that *if* we wanted to run a build
with inconsistent dependencies, then we can. The transitive dependency
closure doesn't prevent that from happening -- it just prevents that
from happening accidentally. :-)
Best regards,
Peter
More information about the nix-dev
mailing list