[Nix-dev] Difference between Pkgs, Super and Self in this Snippet
Profpatsch
mail at profpatsch.de
Fri Apr 15 10:10:28 CEST 2016
On 16-04-13 06:56pm, Nicolas Pierron wrote:
> On Mon, Apr 11, 2016 at 7:34 AM, Roger Qiu <roger.qiu at matrix.ai> wrote:
> > ```
> > { pkgs }: { # pkgs is the fully configured packages, after overrides
> > packageOverrides = super: let self = super.pkgs; in rec { # super is
> > without overrides, self is with
> > # ... overrides go here ...
> > };
> > }
> > ```
> >
> > While I understand that `super` is the package set that hasn't been
> > overridden yet, what's the difference between `self` and `pkgs`? Do both
> > of them have the overrides applied?
>
> For the moment there is no difference between the two.
>
> This makes me think that we should get rid of the `packagesOverrides`
> function, and let the content of config.nix be similar to what
> all-packages.nix is.
>
> My wish by getting rid of `packagesOverrides` function is to make sure
> that we can properly document this in NixOS modules.
There is already a `overridePackages` function in the packageset, which
is used by `packageOverrides` and is similar to what `haskellPackages`
uses, though not identical. People should use it more. :)
I dislike `packageOverrides` in that it creates an implicit global
state which complicates the local understanding of nixpkgs expressions.
Maybe related, I was trying to create a local (module-scoped) nixpkgs
in order to overwrite some packages that are used by options enabled
in that module, but there is no way to do that atm.
Since we have a lot of packages with `xy.packages` (and the rest is not
accessible) I think that would be a worthwhile improvement. Perhaps
it is already possible?
--
Proudly written in Mutt with Vim on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es
May take up to five days to read your message. If it’s urgent, call me.
More information about the nix-dev
mailing list