[Nix-dev] Introducing Nixpkgs Overlays
Benno Fünfstück
benno.fuenfstueck at gmail.com
Tue Dec 27 20:43:12 CET 2016
Hi Nicolas,
I like the idea of Nixpkgs overlays. I have not thought fully about the
whole proposal (and I need to catch up with how security updates work
first), but I think there is small mistake when you say:
As part of this modification, I intend to remove the
`pkgs.overridePackages` function, as this one can literally be
replaced by the following Nix expression:
```nix
let pkgs = import <nixpkgs> {}; in
import pkgs.path { overlay = [ (self: super: {
foo = super.foo.override { enableBar = true; };
bar = import ./pkgs/bar { inherit (self) stdenv fetchurl foo; };
}) ]; }
```
The `overridePackages` function is useful when you want to chain multiple
functions that modify the package set, like
```nix
let
pkgs = import <nixpkgs> {};
pkgsA = functionA pkgs
pkgsB = pkgsA.overridePackages (super: self: {
});
```
In this code example. I do not need to know how functionA is implemented
internally. It seems to me that, if I instead used overlays for this, it
would be hard to achieve the same effect: I would have to manually take
care to re-apply the overrides that `functionA` put in place.
This does not mean that `overridePackages` needs to stay as-is. But perhaps
it would be possible to implement it using overlays, while still providing
the same interface to the user?
Regards,
Benno Fünfstück
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161227/bbdc3405/attachment.html>
More information about the nix-dev
mailing list