doc: Write "Building from the Command Line".
[?]
Oct 12, 2011, 2:20 PM
EE53ECTSDLDTGK6RHSEZHZ42FKK2IIEMXQM5ZMDTQNFWZLR4RAIQCDependencies
- [2]
PKE6I67Sdoc: Import the "Creating Projects" chapter by Visser & Dolstra. - [3]
2LTNY56Wdoc: Add preliminary section about `release.nix'.
Change contents
- replacement in doc/manual/projects.xml at line 356
<title>Building on the Command Line</title><title>Building from the Command Line</title><para>It is often useful to test a build recipe, for instance beforeit is actually used by Hydra, when testing changes, or whendebugging a build issue. Since build recipes for Hydra jobsetsare just plain Nix expressions, they can be evaluated using thestandard Nix tools.</para><para>To evaluate the <varname>tarball</varname> jobset of <xreflinkend='ex-hello' />, just run:<screen>$ nix-build release.nix -A tarball</screen>However, doing this with <xref linkend='ex-hello' /> as is willprobably yield an error like this:<screen>error: cannot auto-call a function that has an argument without a default value (`nixpkgs')</screen>This is because no value was specified for the<varname>nixpkgs</varname> argument of the Nix expression.</para><para>This is fixed by providing a default value for that argument inthe Nix expression, which will allow <command>nix-build</command>to auto-call the function: instfead of writing <literal>{ nixpkgs}:</literal>, we now write <literal>{ nixpkgs ? <nixpkgs>}:</literal>. What it means is that, by default, the<varname>nixpkgs</varname> variable will be bound to the absolutepath of any <filename>nixpkgs</filename> file found in the Nixsearch path. Similarly, a default value for<varname>helloSrc</varname> needs to be provided.</para> - replacement in doc/manual/projects.xml at line 397
Overigens zijn die helemaal niet Hydra-specifiek, je kunt ze gewoon vanaf decommand line bouwen, bijv. als je een patchelf checkout hebt (met een nixpkgscheckout in ../nixpkgs):<para>Thus, assuming a checkout of Nixpkgs is available under<filename>$HOME/src/nixpkgs</filename>, the<varname>tarball</varname> jobset can now be evaluated by running: - replacement in doc/manual/projects.xml at line 402
<screen>$ nix-build release.nix -A rpm_fedora10i386</screen><screen>$ nix-build -I ~/src release.nix -A tarball</screen>Similarly, the <varname>build</varname> jobset can be evaluated:<screen>$ nix-build -I ~/src release.nix -A build</screen>The <varname>build</varname> job reuses the result of the<varname>tarball</varname> job, rebuilding it only if it needs to.</para>