[Nix-dev] How to use .nixpkgs/config.nix?

Mateusz Czaplinski czapkofan at gmail.com
Sun Jun 5 22:56:22 CEST 2016


On Sun, Jun 5, 2016 at 8:14 PM, Vladimír Čunát <vcunat at gmail.com> wrote:
> On 06/05/2016 03:46 PM, Mateusz Czaplinski wrote:
>> The config.nix from Kamil Chmielewski [1] seems somewhat
>> acceptable to me at first sight, but I still don't get why config.nix
>> seems so much more complicated than configuration.nix? Is it possible
>> to make it simpler?
>
> You seem only to want to define your own `all` set within
> `packageOverrides`, so you can drop all the rest. To me that doesn't
> seem significantly more complicated than with `systemPackages`.

Ok, thanks. As to complication: I think what I really tried to
understand here was how and why they seem so different - or from other
point of view, where do they "meet". And now I seem to have found part
of the answer on my own: I thought config.nix was the outlier, because
it uses buildEnv, but it seems it's actually the systemPackages of
configuration.nix which is a "special case" - as it is later wrapped
in a buildEnv too, in nixos/modules/config/system-path.nix. So I seem
to understand that "buildEnv" is the "canonical" form. Still not
really sure where and how the 2 lists of pkgs meet in the end to
become one (if at all?), but at least I kinda understand the
difference in the way they're specified now.

Still, another weirdness in the linked example is the '_pkgs : with
_pkgs; {' part, and then understanding where a non-underscored 'pkgs'
inside the func comes from? Does this mean that the arg to
'packageOverrides', named _pkgs here, contains inside a value named
'pkgs', apart from other values already naming actual packages (like
possibly 'vim' or something)? Or are the packages defined only in the
deeper 'pkgs', while the immediate arg contains rather some other
important stuff (what exactly? the 'buildEnv' and similar tools)?
Then, manual seems to suggest using 'rec' [2], not 'with', but also
sees 'pkgs' inside the func. This I cannot understand yet.

[2] https://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides

>> I'd like to start with a simplest config which would let me add some
>> packages which would be available for my user immediately after login
>> (also when logging in straight to an X session).
>
> Note that you always manage ~/.nix-profile in the "imperative style",
> i.e. you have to run `nix-env -Q -iA nixos.all` command (or similar) to
> install/update that set.

So, by running 'nix-env ...', a package/derivation gets "installed"
from .nixpkgs/config.nix into .nix-profile/manifest.nix,  yes?

Thanks,
/Mateusz Czapliński.


More information about the nix-dev mailing list