mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
bd5324c4fc
Upgrades Hydra to the latest master/flake branch. To perform this upgrade, it's needed to do a non-trivial db-migration which provides a massive performance-improvement[1]. The basic ideas behind multi-step upgrades of services between NixOS versions have been gathered already[2]. For further context it's recommended to read this first. Basically, the following steps are needed: * Upgrade to a non-breaking version of Hydra with the db-changes (columns are still nullable here). If `system.stateVersion` is set to something older than 20.03, the package will be selected automatically, otherwise `pkgs.hydra-migration` needs to be used. * Run `hydra-backfill-ids` on the server. * Deploy either `pkgs.hydra-unstable` (for Hydra master) or `pkgs.hydra-flakes` (for flakes-support) to activate the optimization. The steps are also documented in the release-notes and in the module using `warnings`. `pkgs.hydra` has been removed as latest Hydra doesn't compile with `pkgs.nixStable` and to ensure a graceful migration using the newly introduced packages. To verify the approach, a simple vm-test has been added which verifies the migration steps. [1] https://github.com/NixOS/hydra/pull/711 [2] https://github.com/NixOS/nixpkgs/pull/82353#issuecomment-598269471
48 lines
1.4 KiB
Nix
48 lines
1.4 KiB
Nix
{ system, ... }:
|
|
{
|
|
baseConfig = { pkgs, ... }: let
|
|
trivialJob = pkgs.writeTextDir "trivial.nix" ''
|
|
{ trivial = builtins.derivation {
|
|
name = "trivial";
|
|
system = "${system}";
|
|
builder = "/bin/sh";
|
|
allowSubstitutes = false;
|
|
preferLocalBuild = true;
|
|
args = ["-c" "echo success > $out; exit 0"];
|
|
};
|
|
}
|
|
'';
|
|
|
|
createTrivialProject = pkgs.stdenv.mkDerivation {
|
|
name = "create-trivial-project";
|
|
dontUnpack = true;
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh";
|
|
postFixup = ''
|
|
wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob}
|
|
'';
|
|
};
|
|
in {
|
|
virtualisation.memorySize = 2048;
|
|
time.timeZone = "UTC";
|
|
environment.systemPackages = [ createTrivialProject pkgs.jq ];
|
|
services.hydra = {
|
|
enable = true;
|
|
# Hydra needs those settings to start up, so we add something not harmfull.
|
|
hydraURL = "example.com";
|
|
notificationSender = "example@example.com";
|
|
extraConfig = ''
|
|
email_notification = 1
|
|
'';
|
|
};
|
|
services.postfix.enable = true;
|
|
nix = {
|
|
buildMachines = [{
|
|
hostName = "localhost";
|
|
systems = [ system ];
|
|
}];
|
|
binaryCaches = [];
|
|
};
|
|
};
|
|
}
|