You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nixos-template-base/services/hydra-core.nix

96 lines
3.2 KiB
Nix

{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge mkThenElse;
annuaire = config.r6d.machines;
currentMachine = annuaire."${config.networking.fqdn}";
flags = currentMachine.configurationFlags;
#### https://github.com/NixOS/hydra/issues/413
# Note that we use 'import <nixpkgs> {}' instead of 'pkgs'.
# If we use the latter we get an infinite recursion
# because we include hydra-src in the module imports below which in turn defines the 'pkgs' value.
#hydra-src = (import <nixpkgs> {}).fetchgit {
# url = "https://github.com/NixOS/hydra.git";
# rev = "de55303197d997c4fc5503b52b1321ae9528583d";
# sha256 = "0nimqsbpjxfwha6d5gp6a7jh50i83z1llmx30da4bscsic8z1xly";
#};
#hydra-src-pkg = lib.mkDefault ((import (hydra-src + /release.nix) {}).build.x86_64-linux);
# information pour l'état de hydra :
# hydra-queue-runner --status | json_pp
in
# TODO: passe de ménage
mkIf flags.hydra-core {
# Paquets
environment.systemPackages = with pkgs; [
];
# Documentation HYDRA
## Installation
# 1. créer clef SSH :
# ssh-keygen -C "hydra@pedro.dubronetwork.fr" -N "" -f /etc/nixos/id_buildfarm
# 2. récupérer la clef publique du serveur ssh + l'ajouter dans les `knownHosts` :
# ssh-keyscan localhost
# 3. créer un utilisateur pour gérer hydra
# su - hydra
# hydra-create-user jpierre03 --password xxx --role 'admin'
# 4. relancer hydra
# 5. ajouter un vhost à nginx
# 6. relancer nginx
# 7. le service accessible à hydra.<nom de machine>
## Tutoriel
# * https://github.com/peti/hydra-tutorial
# Services
## Hydra
services.hydra = {
enable = true;
hydraURL = "http://hydra.${config.networking.fqdn}";
notificationSender = "hydra@${config.networking.fqdn}";
listenHost = "localhost";
minimumDiskFree = 50; # Go
smtpHost = "localhost";
#package = hydra-src-pkg ;
};
systemd.services.hydra-evaluator.serviceConfig.Nice = -19;
#systemd.services.hydra-evaluator = {
# path = [ pkgs.nettools config.services.hydra.package ];
#};
## Ménage
#nix.gc.automatic = true;
## Délégation des actions de compilation à la ferme de compilation
### Machines connues
programs.ssh.knownHosts = {
"hydra.prunetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYrZu31+/ybhel7LNPNgsALEoMHwTc1OiTcmJnXZ3He";
"monstre.dubronetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTTrLhq1Cwm0rpnwEIxSLqVrJWZnt+/9dt+SKd8NiIc";
"pedro.dubronetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7fjo2ysLqlfSo6BKnc6I6m1ayoPrbwEEyTKZmUzsOD";
"ocean.prunetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINCaRuTl8iCTUE4XInOpkSlwQj5Re4w4Iq+gNIlJe8pA";
"radx.prunetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGyoXdTEnxSgZTMfRfVH+bpOGZJtJpydAijcRGsZik7U";
"rollo.dubronetwork.fr".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID4lWgS/sVdcZvnAAN+lBSOcCL9ISdAUsjp1kh9lalNu";
};
### La liste des machines utilisées
nix = {
distributedBuilds = false;
buildMachines = [
# { hostName = "pedro.dubronetwork.fr"; maxJobs = 5; speedFactor = 10; sshKey = "/etc/nixos/id_buildfarm"; sshUser = "root"; system = "x86_64-linux"; }
];
extraOptions = "auto-optimise-store = true";
};
}