[Nix-dev] variable scope / recursion

Marc Weber marco-oweber at gmx.de
Fri Jul 6 14:12:00 CEST 2012


Excerpts from Mathijs Kwik's message of Fri Jul 06 11:53:28 +0200 2012:
>   packageOverrides = pkgs:
>     { foo = "string";
>       bar = pkgs.foo + " concatenation";
>     };

solution a) use rec:


(rec {
  foo = ...
  bar = foo 
  ;
})

solution b,c )
  use let recursion or fix function (which in turn can be implemented by
  let recursion or such).

second: read comments & code: pkgs is the original pkgs, not the patched one:

  overrider pkgsOrig // ..

Then it should be clear wy foo is not known.

Marc Weber


More information about the nix-dev mailing list