[Nix-dev] stdenv.mkDerivation and cmake

Alexander Foremny alexanderforemny at gmail.com
Wed Jul 25 10:42:55 CEST 2012


Hello,

I am currently working on a Nix expression for XBMC [1] and
encountered some oddities. The first one is that including cmake as
buildInput somehow changes the build process. Consider the following
example.

> { stdenv, fetchurl }:
> stdenv.mkDerivation {
>   name = "xbmc-11.0";
>  src = fetchurl {
>    url = http://mirrors.xbmc.org/releases/source/xbmc-11.0.tar.gz;
>    sha256 = "068bgg6h593xwwinyqy8wsn4hpz90ib59g0k5dpg4f31q48d7r8z";
>  };
>   buildInputs = [];
>   configurePhase = "exit 12";
> }

> $ nix-build -A xbmc default.nix
> ...
> configuring
> builder for `/nix/store/f0hg75jnbghla0hw617z9hvn306q8dan-xbmc-11.0.drv' failed with exit code 12

Great! This is what I expected. However, using the same Nix
expression, only with cmake added to arguments and buildInputs I get
the following result.

> $ nix-build -A xbmc default.nix
> ...
> configuring
> fixing cmake files...
> cmake flags: -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_PREFIX=/nix/store/rd5ki...-xbmc-11.0
> CMake Error: The source directory "/tmp/nix-build-6ngw5...-xbmc-11.0.drv-0/xbmc-11.0" does not appear to contain CMakeLists.txt.
> Specify --help for usage, or press the help button on the CMake GUI.
> builder for `/nix/store/6ngw5...-xbmc-11.0.drv' failed with exit code 1

So stdenv.mkDerivation seems to run some kind of fix prior to my
configurePhase now. This seems to be reasonable behavior. However,
since it fails in my case, where can I read up on why this is
necessary and how to disable or fix the test?

As a work-around I added the following line to the Nix expression
> patchPhase = "touch CMakeLists.txt";
and now I get the following output.

> $ nix-build -A xbmc default.nix
> ...
> configuring
> fixing cmake files...
> ...
> building
> make flags:
> building cmake_check_build_system
> building all
> installing
> install flags: install
> make: *** No rule to make target `install'.  Stop.
> builder for `/nix/store/ajhwkj...-xbmc-11.0.drv' failed with exit code 2

Clearly my custom configurePhase is skipped! Why is that?

Since I cannot find anything relevant in the sources, any insight
would be greatly appreciated. Also, Google did not come up with
anything and I am unable to find any documentation.

Regards,
Alexander Foremny


More information about the nix-dev mailing list