YKD7OW6TMFSUWBTWBMVCVFVHIOTTAUPVLK23MXE4GZUOWEYCKWJQC W4LDVLQFV4NARA2L7OY6X2DIO4IDGBFK72L2HSB52WGA6EGM5FDQC IGXQ45S5VPEGUOCYLE6HJ7AWS4AIM6RIVQ4FELXX7E67IQAQBGPQC 6ZHQKBZP3ZWFXEGYR3TYRQANRLVO6PBM7X5DK6Z7JMNMPY6A6Z7AC 2LTNY56W6QEDRSI6IWRZGQPTJTAFQSGIQO6FBTU7M4VQCTF6OVNAC PKE6I67S7TDGKEFCKIQZOZ5PSDZXCSPOQGSKDAE5NST3NOOLRUXAC NXO2ZIBUSCY5RSM6IFVU2PDHM3X66F3TH6PI6DSJGUQ3DTBJEWRAC EE53ECTSDLDTGK6RHSEZHZ42FKK2IIEMXQM5ZMDTQNFWZLR4RAIQC LW755CJKCIPO7NR7D5TP5WZNGCP5UWLBMA7KJXMHJEB6XIJJGO3QC This specifies a function of one named arguments,<varname>nixpkgs</varname>. This function and thosedefined below is called by Hydra. Here the<varname>nixpkgs</varname> argument is meant to be acheckout of the <linkxlink:href="http://nixos.org/nixpkgs/">Nixpkgs</link>software distribution.
This defines a variable <varname>pkgs</varname> holdingthe set of packages provided by <linkxlink:href="http://nixos.org/nixpkgs/">Nixpkgs</link>.
Hydra inspects the formal argument list of the function(here, the <varname>nixpkgs</varname> argument) and passesit the corresponding parameter specified as a build inputon Hydra's web interface. In this case, the web interfaceshould show a <varname>nixpkgs</varname> build input,which is a checkout of the Nixpkgs source code repository.</para></callout><callout arearefs='ex-hello-co-import-nixpkgs'><para>This defines a variable <varname>pkgs</varname> holdingthe set of packages provided by Nixpkgs.
Since <varname>nixpkgs</varname> appears in angle brackets,there must be a build input of that name in the Nix searchpath. In this case, the web interface should show a<varname>nixpkgs</varname> build input, which is a checkoutof the Nixpkgs source code repository; Hydra then adds thisand other build inputs to the Nix search path whenevaluating <filename>release.nix</filename>.
The <varname>tarball</varname> takes an additionalargument called <varname>helloSrc</varname>. Again, thisargument is passed by Hydra and is meant to be a checkoutof GNU Hello's source code repository.
The <varname>tarball</varname> jobs expects a<varname>hello</varname> build input to be available in theNix search path. Again, this input is passed by Hydra andis meant to be a checkout of GNU Hello's source coderepository.
The <varname>build</varname> function takes two additionalparameter: <varname>tarball</varname>, which is meant tobe the result of the <varname>tarball</varname> job, and<varname>system</varname>, which should be a string
The <varname>build</varname> function takes oneparameter, <varname>system</varname>, which should be a string
Again, these parameters are passed by Hydra when it calls<varname>build</varname>. Thus, they must be defined asbuild inputs in Hydra: <varname>tarball</varname> shouldhave type <literal>Build Output</literal>, its value beingthe latest output of the <varname>tarball</varname> job,and <varname>system</varname> should be a string.
Hydra inspects the formal argument list of the function(here, the <varname>system</varname> argument) and passes itthe corresponding parameter specified as a build input onHydra's web interface. Here, <varname>system</varname> ispassed by Hydra when it calls <varname>build</varname>.Thus, it must be defined as a build input of type string inHydra, which could take one of several values.
The question mark after <literal>tarball</literal> and<literal>system</literal> defines default values for thesearguments, and is only useful for debugging.
The question mark after <literal>system</literal> definesthe default value for this argument, and is only useful whendebugging locally.
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>
<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:
The error is self-explanatory. Assuming<filename>$HOME/src/hello</filename> points to a checkout ofHello, this can be fixed this way: