Hydra/en: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
 
FuzzyBot (talk | contribs)
Updating to match new version of source page
Line 4: Line 4:
The official Hydra servers provide pre-built binary packages to speed up the update time for Nixpgs: Users do not have to compile them on their own computers.
The official Hydra servers provide pre-built binary packages to speed up the update time for Nixpgs: Users do not have to compile them on their own computers.


The [https://nixos.org/hydra/manual/ Hydra manual] provides an overview of the functionality and features of hydra, as well as an up-to-date installation guide.  
The [https://nixos.org/hydra/manual/ Hydra manual] provides an overview of the functionality and features of Hydra, as well as an up-to-date installation guide.  


== Installation ==
== Installation ==
Since 2017, hydra is available as a NixOS module and therefore a full deployment can be enabled as easy as
 
A full deployment can be enabled as easy as:
 
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
   services.hydra = {
   services.hydra = {
     enable = true;
     enable = true;
     hydraURL = "http://localhost:3000"; # externally visible URL
     hydraURL = "http://localhost:3000"; # externally visible URL
     notificationSender = "hydra@localhost"; # e-mail of hydra service
     notificationSender = "hydra@localhost"; # e-mail of Hydra service
     # a standalone hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistant /etc/nix/machines
     # a standalone Hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistant /etc/nix/machines
     buildMachinesFiles = [];
     buildMachinesFiles = [];
     # you will probably also want, otherwise *everything* will be built from scratch
     # you will probably also want, otherwise *everything* will be built from scratch
Line 19: Line 21:
   };
   };
</syntaxHighlight>
</syntaxHighlight>
The module will automatically enable postgresql if you do not change the <code>services.hydra.dbi</code> option. Database layout will be created automatically by the hydra service, however keep in mind that some state will be stored in the database and a complete stateless configuration is currently not possible - do your backups.
 
The module will automatically enable postgresql if you do not change the <code>services.hydra.dbi</code> option. Database layout will be created automatically by the Hydra service, however keep in mind that some state will be stored in the database and a complete stateless configuration is currently not possible - do your backups.
* See nixos-option or the [https://search.nixos.org/options?query=services.hydra Nixos Options page] for all options
* See nixos-option or the [https://search.nixos.org/options?query=services.hydra Nixos Options page] for all options


=== Web Configuration ===
=== Web Configuration ===
Hydra will provide the web interface [http://localhost:3000/ at localhost] port 3000. However you need to create a new admin user (as unix user <code>hydra</code>) before being able to perform any changes:
Hydra will provide the web interface [http://localhost:3000/ at localhost] port 3000. However you need to create a new admin user (as UNIX user <code>hydra</code>) before being able to perform any changes:
<syntaxHighlight lang=bash>
<syntaxHighlight lang=bash>
# su - hydra
# su - hydra
Line 44: Line 47:
</syntaxHighlight>
</syntaxHighlight>


This option leads to the file /etc/nix/machines being created. If the hydra service config is still set to buildMachinesFiles = [], then it will be ignored, so remove this option again or add /etc/nix/machines to it.
This option leads to the file /etc/nix/machines being created. If the hydra service config is still set to buildMachinesFiles = [], then it will be ignored, so remove this option again or add <code>/etc/nix/machines</code> to it.
 


== Flake jobset ==
== Flake jobset ==


Configure jobset the following:
Configure jobset to the following:


* Type: Flake
* Type: Flake
Line 93: Line 95:
=== Imperative Building ===
=== Imperative Building ===
These steps are required to build the <code>hello</code> package.
These steps are required to build the <code>hello</code> package.
# log into hydra after creating a user with <code>hydra-create-user</code>
# log into Hydra after creating a user with <code>hydra-create-user</code>
# create new project
# create new project
* identifier: example-hello
* identifier: example-hello
Line 115: Line 117:


=== Declarative Building ===
=== Declarative Building ===
Since 2016, hydra supports declarative creation of jobsets. Check out the [https://github.com/shlevy/declarative-hydra-example example repository and description by Shea Levy].
Since 2016, Hydra supports declarative creation of jobsets. Check out the [https://github.com/shlevy/declarative-hydra-example example repository and description by Shea Levy].


== Hydra Internals ==
== Hydra Internals ==
Line 122: Line 124:


==== Project ====  
==== Project ====  
A cluster of Jobs which are all coming from a single input (like a git checkout), the first thing you will need to create. Every Job should be able to be built independently from another. Most of the time the project maps to a single repository like <code>nixpkgs</code>. It is comparable to the project definition in Jenkins
A cluster of Jobs which are all coming from a single input (like a git checkout), the first thing you will need to create. Every Job should be able to be built independently from another. Most of the time the project maps to a single repository like <code>nixpkgs</code>. It is comparable to the project definition in Jenkins.


==== Job Set ====
==== Jobsets ====
A list of jobs which will be run. Often a Jobset fits to a certain branch (master, staging, stable). A jobset is defined by its inputs and will trigger if these inputs change, e.g. like a new commit onto a branch is added. Job sets may depend on each other
A Jobset is a list of jobs which will be run. Often a jobset fits to a certain branch (master, staging, stable). A Jobset is defined by its inputs and will trigger if these inputs change. For example when a new commit onto a branch is added. Jobsets may depend on each other.


==== Job ====
==== Job ====
A closure which will be built as part of a jobset (like a single package, iso image or tarball)
A closure which will be built as part of a job set (like a single package, iso image or tarball).


==== Release Set ====
==== Release Set ====
Line 134: Line 136:


==== Evaluation ====
==== Evaluation ====
The process of interpreting nix code into a list of <code>.drv files</code>. These files are the build recipes for all related outputs. You can introspect these files by running <code>nix show-derivation nixpkgs.hello</code>
The process of interpreting nix code into a list of <code>.drv files</code>. These files are the build recipes for all related outputs. You can introspect these files by running <code>nix show-derivation nixpkgs.hello</code>.


==== Build ====
==== Build ====
Instantiation of a Job which is being triggered by being part of the release set
Instantiation of a Job which is being triggered by being part of the release set.


== Known Issues ==
== Known Issues ==