[Nix-dev] $out in configureFlags is not expanded
Malcolm Matalka
mmatalka at gmail.com
Tue May 21 15:04:33 CEST 2013
Not sure how correct this is, but I grepped my nixpkgs in attempted to
quantify this a bit, here are the results:
$ grep -R configureFlags . | wc -l
951
$ grep -R configureFlags . | grep -E '\$[^{]' | wc -l
156
Marc Weber <marco-oweber at gmx.de> writes:
> 1) I remember having hit this case, too.
>
> 2) If we don't want to break builds, we could at least change setup.sh
> to test whethet it countains $out, if it does, cause error message:
> use preConfigure = ''
> ...
> ''
> instead.
>
> About changing semantics: I don't think it would affect any existing
> builds, becaues you just neven pass literal $out to a configure script
> - or does anybody remebmber having done so?
>
> Cases I know about where you want to presever $out are setup hooks for
> instance. So replacing all $out by the path would be too much -
>
>
>> preConfigure = ''configureFlags="--foo=$out/etc/foo.cfg"'';
>> works just fine. Maybe it would be sufficient to document the current
>> behavior in more detail?
> Yes - it works. However nix is a tool, and it should make the "average
> case" simple - but - if we started doing so - we had to document where
> $out substitution happens etc. So eventually I'd vote for creating a
> wiki page, explaining this in detail, that attr are just passed "as is"
> as env vars, to use preConfigure.
>
> Thinking about it I'd vote for such solution if we are about changing
> anything:
>
> mkDerivation {
> # NEW, implicit: you don't have to pass this, because its default
> # but you can opt-out [] or opt-in ["configureFlags","other-env-var"]
> substituteOut = ["configureFlags"];
>
> configureFlags="--prefix=$out"
> }
>
> On the other hand maybe its not that bad that people run into this
> problem, because they'll learn and understand how derivations work this
> way :)
>
> Marc Weber
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
More information about the nix-dev
mailing list