[Nix-dev] Difference between Pkgs, Super and Self in this Snippet
Roger Qiu
roger.qiu at matrix.ai
Sat Apr 16 06:45:36 CEST 2016
How do _you_ use overridePackages?
On 15/04/2016 6:10 PM, Profpatsch wrote:
> 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?
>
--
Founder of Matrix AI
https://matrix.ai/
+61420925975
More information about the nix-dev
mailing list