[Nix-dev] variable scope / recursion

Kirill Elagin kirelagin at gmail.com
Fri Jul 6 12:01:04 CEST 2012


rec is the answer (this is something like let/letrec in Lisp, if you know
what I mean ;) ).

--
Кирилл Елагин


2012/7/6 Mathijs Kwik <mathijs at bluescreen303.nl>

> Hi all,
>
> I was reading this interesting piece of all-packages.nix
> (comments/whitespace removed):
>
>   applyGlobalOverrides = overrider:
>     let
>       overrides = overrider pkgsOrig //
>         (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem
> == null) (pkgsOrig.stdenv.overrides pkgsOrig));
>       pkgsOrig = pkgsFun pkgs {};
>       pkgs = pkgsFun pkgs overrides;
>     in pkgs;
>
> I'm familiar with tying-the-knot lazy trickery in haskell.
> As pkgsOrig uses pkgs (the final end result including overrides), and
> the overrider function gets passed pkgsOrig, I would expect the
> following to work:
>
>   packageOverrides = pkgs:
>     { foo = "string";
>       bar = pkgs.foo + " concatenation";
>     };
>
> However, it complains about foo missing.
> What am I missing?
>
> Thanks,
> Mathijs
> _______________________________________________
> 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/20120706/7d47a18d/attachment.html 


More information about the nix-dev mailing list