[Nix-dev] Overwriting or merging Nix expressions
Wout Mertens
wout.mertens at gmail.com
Mon Jul 7 19:08:17 CEST 2014
Hi Roger,
to override in this way, you can merge attribute sets with the // operator,
which will prefer the attribute on the right-hand side.
http://nixos.org/nix/manual/#idm47361539098656
you get the duplicate error because the language is functional, everything
at the same level is evaluated at the same time. You can enforce ordering
with let.
Wout.
On Mon, Jul 7, 2014 at 8:50 AM, Roger Qiu <roger.qiu at polycademy.com> wrote:
> Hello Nix Devs,
>
> I was wondering if there's a way to override Nix expressions.
>
> Say I define a Nix expressions such as:
>
> something.enable = true;
>
> But later on I decide to change it to:
>
> something.enable = false;
>
> Would this work? I find myself getting duplicate errors. One time I had
> something like this:
>
> services.cron.enable = false;
>
> services = {
> other.stuff = blah;
> };
>
> And this resulted in a duplicate error. This example is actually more to
> do with merging rather than conflicting entries.
>
> However, say if I had a nix file called B.nix, and in A.nix I imported
> B.nix, I may sometimes want to overwrite that was in B. I find myself
> needing to do this with the generated hardware-configuration.nix file.
>
> Thanks,
> Roger
>
> --
> Founder of Polycademy & SnapSearch
> http://polycademy.com
> https://snapsearch.io
> +61420925975
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140707/3846a1c2/attachment-0001.html
More information about the nix-dev
mailing list