"Reproduce" action: Support flakes

No more need for a reproduction script! It just says something like

  If you have Nix installed, you can reproduce this build on your own
  machine by running the following command:

  # nix build github:edolstra/dwarffs/09c823e977946668b63ad6c88ed358b48220f124:hydraJobs.build.x86_64-linux
This commit is contained in:
Eelco Dolstra 2019-05-11 00:52:25 +02:00
parent 4ec51032ee
commit f68cb7b57e
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -120,7 +120,7 @@ END;
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
[% IF build.nixexprinput %]
[% IF build.nixexprinput || eval.flake %]
<li><a href="#reproduce" data-toggle="modal">Reproduce locally</a></li>
[% END %]
[% IF c.user_exists %]
@ -532,18 +532,33 @@ END;
<div class="modal-body">
<p>You can reproduce this build on your own machine by downloading
<a [% HTML.attributes(href => url) %]>a script</a> that checks out
all inputs of the build and then invokes Nix to perform the build.
This script requires that you have Nix on your system.</p>
[% IF eval.flake %]
<p>If you have <a href='https://nixos.org/nix/download.html'>Nix
installed</a>, you can reproduce this build on your own machine by
running the following command:</p>
<pre>
<span class="shell-prompt"># </span>nix build [% HTML.escape(eval.flake) %]:hydraJobs.[% HTML.escape(job.name) %]
</pre>
[% ELSE %]
<p>If you have <a href='https://nixos.org/nix/download.html'>Nix
installed</a>, you can reproduce this build on your own machine by
downloading <a [% HTML.attributes(href => url) %]>a script</a>
that checks out all inputs of the build and then invokes Nix to
perform the build.</p>
<p>To download and execute the script from the command line, run the
following command:</p>
<pre>
<span class="shell-prompt">$ </span>curl <a [% HTML.attributes(href => url) %]>[% HTML.escape(url) %]</a> | bash
<span class="shell-prompt"># </span>curl <a [% HTML.attributes(href => url) %]>[% HTML.escape(url) %]</a> | bash
</pre>
[% END %]
</div>
<div class="modal-footer">