[Nix-dev] replaceStdenv question
Marc Weber
marco-oweber at gmx.de
Sun Jun 15 02:15:19 CEST 2008
On Sun, Jun 15, 2008 at 12:27:45AM +0200, Peter Simons wrote:
> Hi,
>
> I observe some weird behavior with following ~/.nixpkg/config.nix file:
>
> {
> replaceStdenv = { stdenv, overrideSetup }: stdenv //
> {
> mkDerivation = args: stdenv.mkDerivation (args // { configureFlags = "CFLAGS=-O3"; });
> };
> }
>
> When I install pcre from the unstable packages using "nix-env -i pcre",
> the call to configure is exactly as I'd it expect to be:
>
> configure flags: --disable-dependency-tracking \
> --prefix=/nix/store/aaxgzf9qs1m2jwvmnfi88lk97n2ya9nn-pcre-7.4 \
> CFLAGS=-O3
>
> When, I add the following attribute to config.nix
>
> {
> replaceStdenv = ... ;
>
> pcre = { unicode = true; };
> }
>
> ..., however, my custom CFLAGS disappear:
>
> configure flags: --disable-dependency-tracking \
> --prefix=/nix/store/dx1xhm7z0wip21wiaxfig8zrsqywan85-pcre-7.4 \
> --enable-unicode-properties --enable-shared --disable-static
>
> I would assume that my overridden mkDerivation function evaluates
> *after* the pcre builder, so as far as I can tell, configureFlags should
> have the value my functions sets. But obviously that is not the case.
> Why is that?
>
> Any insight would be appreciated.
I can't give you insight right now, but maybe a tip how to debug it:
There is builtins.trace, so you can write your own trace fuctnion
traceCF = location : args : builtins.trace
"${location}: ${ if args ? configureFlags then "flags are: ${args.configureFlags}" else "no flags"}"
args
m
Then you can use it this way and hope that it will show you what you need ?
> mkDerivation = args: stdenv.mkDerivation (traceCF "before passing to mkDerivation" (args // { configureFlags = "CFLAGS=-O3"; }) );
also use something such as
postUnpack = "export"; to see which env vars has been passed to the
builder.
pcre contains:
configureFlags =
(if unicodeSupport then
"--enable-unicode-properties --enable-shared --disable-static"
else "") +
(if !cplusplusSupport then "--disable-cpp" else "");
I really wonder what will happen if you enable unicodeSupport and do not
disable cplusplusSupport.. doesn't this result in
"--enable-unicode-properties --enable-shared --disable-static--disable-cpp" ?
^^ no space
Marc Weber
More information about the nix-dev
mailing list