Merge pull request #730 from NixOS/flake

Flake support
This commit is contained in:
Eelco Dolstra
2020-04-07 11:18:38 +02:00
committed by GitHub
16 changed files with 609 additions and 387 deletions

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 %]
@ -530,18 +530,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">

View File

@ -42,7 +42,7 @@
[% END %]
[% BLOCK renderJobsetInputs %]
<table class="table table-striped table-condensed">
<table class="table table-striped table-condensed show-on-legacy">
<thead>
<tr><th></th><th>Input name</th><th>Type</th><th style="width: 50%">Value</th><th>Notify committers</th></tr>
</thead>
@ -97,6 +97,24 @@
</div>
<div class="control-group">
<label class="control-label">Type</label>
<div class="controls">
<div class="btn-group" data-toggle="buttons-radio">
<input type="hidden" id="type" name="type" value="[% jobset.type %]" />
<button type="button" class="btn" value="1" id="type-flake">Flake</button>
<button type="button" class="btn" value="0" id="type-legacy">Legacy</button>
</div>
</div>
</div>
<div class="control-group show-on-flake">
<label class="control-label">Flake URI</label>
<div class="controls">
<input type="text" class="span3" name="flakeref" [% HTML.attributes(value => jobset.flake) %]/>
</div>
</div>
<div class="control-group show-on-legacy">
<label class="control-label">Nix expression</label>
<div class="controls">
<input type="text" class="span3" name="nixexprpath" [% HTML.attributes(value => jobset.nixexprpath) %]/>
@ -168,6 +186,21 @@
$(document).ready(function() {
var id = 0;
function update() {
if ($("#type").val() == 0) {
$(".show-on-legacy").show();
$(".show-on-flake").hide();
} else {
$(".show-on-legacy").hide();
$(".show-on-flake").show();
}
}
$("#type-flake").click(function() { update(); });
$("#type-legacy").click(function() { update(); });
update();
$(".add-input").click(function() {
var newid = "input-" + id++;
var x = $("#input-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();

View File

@ -8,7 +8,7 @@
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="enabled" [% IF project.enabled; 'checked="checked"'; END %]/>Enabled
<input type="checkbox" name="enabled" [% IF create || project.enabled; 'checked="checked"'; END %]/>Enabled
</label>
</div>
<div class="controls">

View File

@ -18,7 +18,8 @@
</ul>
</div>
<p>This evaluation was performed on [% INCLUDE renderDateTime
<p>This evaluation was performed [% IF eval.flake %]from the flake
<tt>[%HTML.escape(eval.flake)%]</tt>[%END%] on [% INCLUDE renderDateTime
timestamp=eval.timestamp %]. Fetching the dependencies took [%
eval.checkouttime %]s and evaluation took [% eval.evaltime %]s.</p>

View File

@ -135,6 +135,15 @@
<th>Description:</th>
<td>[% HTML.escape(jobset.description) %]</td>
</tr>
[% IF jobset.type == 1 %]
<tr>
<th>Flake URI:</th>
<td>
<tt>[% HTML.escape(jobset.flake) %]</tt>
</td>
</tr>
[% END %]
[% IF jobset.type == 0 %]
<tr>
<th>Nix expression:</th>
<td>
@ -142,6 +151,7 @@
<tt>[% HTML.escape(jobset.nixexprinput) %]</tt>
</td>
</tr>
[% END %]
<tr>
<th>Check interval:</th>
<td>[% jobset.checkinterval || "<em>disabled</em>" %]</td>
@ -166,7 +176,9 @@
</tr>
</table>
[% IF jobset.type == 0 %]
[% INCLUDE renderJobsetInputs %]
[% END %]
</div>
[% INCLUDE makeLazyTab tabName="tabs-jobs" uri=c.uri_for('/jobset' project.name jobset.name "jobs-tab") %]