[Nix-dev] $out in configureFlags is not expanded
Marc Weber
marco-oweber at gmx.de
Tue May 21 14:18:00 CEST 2013
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
More information about the nix-dev
mailing list