[Nix-dev] $out in configureFlags is not expanded

Bjørn Forsman bjorn.forsman at gmail.com
Sat May 18 19:11:32 CEST 2013


Hi,

I noticed today that $out in configureFlags is not expanded. So this
will not do what you'd think:

    configureFlags = "--foo=$out/etc/foo.cfg";

Instead, it will pass --foo=$out/etc/foo.cfg (literally) to configure.
(And if using ${out}, nix will complain about undefined variable
'out'.)

There are a number of packages that put $out in configureFlags:

    $ grep -rn --include="*.nix" '^\s*\<configureFlags\>.*\$out' pkgs/ | wc -l
    38

I wonder if this can be solved in the generic builder by adding "eval
configureFlags=$configureFlags" or something like that. And if that
works, I guess we'll also use eval for cmakeFlags and such.

For now I'm using this as a workaround to force expansion of $out (a
trick I picked up from the v4l-utils nix expression):

   preConfigure = ''configureFlags="--foo=$out/etc/foo.cfg"'';

Best regards,
Bjørn Forsman


More information about the nix-dev mailing list