2019-03-20 02:57:59 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
|
|
|
# hydra user needs to be manually crated
|
|
|
|
# sudo -u hydra -s
|
|
|
|
# hydra-create-user $USERNAME --password $PASSWORD --role admin
|
|
|
|
|
2019-03-23 02:50:48 +01:00
|
|
|
# https://qfpl.io/posts/nix/starting-simple-hydra/
|
|
|
|
# also for reference a well written hydra config:
|
2019-03-04 10:35:50 +01:00
|
|
|
# https://github.com/NixOS/nixos-org-configurations/blob/master/delft/hydra.nix
|
|
|
|
|
2019-03-20 02:57:59 +01:00
|
|
|
with lib;
|
|
|
|
|
2019-03-27 13:48:09 +01:00
|
|
|
mkIf (elem "hydra" config.machine.services) rec {
|
2019-02-26 13:44:40 +01:00
|
|
|
# also take a look at ../conf/nix.nix
|
|
|
|
nix.buildMachines = [
|
|
|
|
{
|
|
|
|
hostName = "localhost";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
|
|
|
|
maxJobs = 8;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
services.hydra = {
|
|
|
|
enable = true;
|
2019-03-23 02:50:48 +01:00
|
|
|
hydraURL = "https://builder.${config.machine.domain}"; # externally visible URL
|
2019-02-26 13:44:40 +01:00
|
|
|
listenHost = "localhost";
|
|
|
|
port = 3001;
|
|
|
|
minimumDiskFree = 15;
|
|
|
|
minimumDiskFreeEvaluator = 15;
|
2019-03-23 02:50:48 +01:00
|
|
|
notificationSender = "hydra@mail.${config.machine.domain}"; # e-mail of hydra service
|
2019-02-26 13:44:40 +01:00
|
|
|
useSubstitutes = true;
|
|
|
|
debugServer = false;
|
2019-03-23 02:50:48 +01:00
|
|
|
# Hints from hydra-queue-runner:
|
|
|
|
# binary_cache_dir is deprecated and ignored. use store_uri=file:// instead
|
|
|
|
# hydra.conf: binary_cache_secret_key_file is deprecated and ignored. use store_uri=...?secret-key= instead
|
2019-03-04 10:35:50 +01:00
|
|
|
extraConfig = ''
|
|
|
|
max_output_size = 4294967296
|
2019-03-23 02:50:48 +01:00
|
|
|
store_uri = file:///var/cache/hydra?secret-key=/secret/hydra_cache&write-nar-listing=1&ls-compression=br&log-compression=br
|
|
|
|
# add ?local-nar-cache= to set nar cache location
|
|
|
|
server_store_uri = https://cache.${config.machine.domain}
|
|
|
|
binary_cache_public_uri https://cache.${config.machine.domain}
|
2019-03-04 10:35:50 +01:00
|
|
|
upload_logs_to_binary_cache = true
|
|
|
|
'';
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
2019-03-27 13:48:09 +01:00
|
|
|
|
|
|
|
services.nix-serve = {
|
|
|
|
enable = true;
|
|
|
|
bindAddress = "172.0.0.1";
|
|
|
|
port = 5000;
|
|
|
|
secretKeyFile = "/secret/hydra_cache";
|
|
|
|
extraParams = ''
|
|
|
|
# Dont know how to change the store root yet...
|
|
|
|
# --user hydra-queue-runner
|
|
|
|
# --group hydra
|
|
|
|
'';
|
|
|
|
};
|
2019-02-26 13:44:40 +01:00
|
|
|
}
|