<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Out-of-tree_build</id>
	<title>Out-of-tree build - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Out-of-tree_build"/>
	<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Out-of-tree_build&amp;action=history"/>
	<updated>2026-04-05T10:28:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.0</generator>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=Out-of-tree_build&amp;diff=9775&amp;oldid=prev</id>
		<title>imported&gt;Milahu: create page: Out-of-tree build</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Out-of-tree_build&amp;diff=9775&amp;oldid=prev"/>
		<updated>2022-05-23T15:29:52Z</updated>

		<summary type="html">&lt;p&gt;create page: Out-of-tree build&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;By default, &amp;lt;code&amp;gt;stdenv.mkDerivation&amp;lt;/code&amp;gt;&lt;br /&gt;
will run &amp;lt;code&amp;gt;configure&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; in the source root,&amp;lt;br&amp;gt;&lt;br /&gt;
but some projects require an out-of-tree build&lt;br /&gt;
&lt;br /&gt;
Example: the build script&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxHighlight lang=bash&amp;gt;&lt;br /&gt;
./autogen.sh&lt;br /&gt;
&lt;br /&gt;
# out-of-tree build&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
&lt;br /&gt;
../configure --enable-feature-a&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/syntaxHighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be translated to the Nix expression&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxHighlight lang=nix&amp;gt;&lt;br /&gt;
stdenv.mkDerivation {&lt;br /&gt;
&lt;br /&gt;
  preConfigure = &amp;#039;&amp;#039;&lt;br /&gt;
    patchShebangs .&lt;br /&gt;
    ./autogen.sh&lt;br /&gt;
&lt;br /&gt;
    mkdir build&lt;br /&gt;
    cd build&lt;br /&gt;
  &amp;#039;&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
  configureScript = &amp;quot;../configure&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  configureFlags = [&lt;br /&gt;
    &amp;quot;--enable-feature-a&amp;quot;&lt;br /&gt;
  ];&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxHighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Milahu</name></author>
	</entry>
</feed>