mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
Merge pull request #9830 from hercules-ci/test-cross-version-remote-build
tests/nixos: Test remote build against older versions
This commit is contained in:
commit
74534829f2
@ -28,6 +28,13 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
# Checks that a NixOS configuration does not contain any references to our
|
||||
# locally defined Nix version.
|
||||
checkOverrideNixVersion = { pkgs, lib, ... }: {
|
||||
# pkgs.nix: The new Nix in this repo
|
||||
# We disallow it, to make sure we don't accidentally use it.
|
||||
system.forbiddenDependenciesRegex = lib.strings.escapeRegex "nix-${pkgs.nix.version}";
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
@ -35,8 +42,101 @@ in
|
||||
|
||||
remoteBuilds = runNixOSTestFor "x86_64-linux" ./remote-builds.nix;
|
||||
|
||||
# Test our Nix as a client against remotes that are older
|
||||
|
||||
remoteBuilds_remote_2_3 = runNixOSTestFor "x86_64-linux" {
|
||||
name = "remoteBuilds_remote_2_3";
|
||||
imports = [ ./remote-builds.nix ];
|
||||
builders.config = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3;
|
||||
};
|
||||
};
|
||||
|
||||
remoteBuilds_remote_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: {
|
||||
name = "remoteBuilds_remote_2_13";
|
||||
imports = [ ./remote-builds.nix ];
|
||||
builders.config = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3;
|
||||
};
|
||||
});
|
||||
|
||||
# TODO: (nixpkgs update) remoteBuilds_remote_2_18 = ...
|
||||
|
||||
# Test our Nix as a builder for clients that are older
|
||||
|
||||
remoteBuilds_local_2_3 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: {
|
||||
name = "remoteBuilds_local_2_3";
|
||||
imports = [ ./remote-builds.nix ];
|
||||
nodes.client = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3;
|
||||
};
|
||||
});
|
||||
|
||||
remoteBuilds_local_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: {
|
||||
name = "remoteBuilds_local_2_13";
|
||||
imports = [ ./remote-builds.nix ];
|
||||
nodes.client = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_13;
|
||||
};
|
||||
});
|
||||
|
||||
# TODO: (nixpkgs update) remoteBuilds_local_2_18 = ...
|
||||
|
||||
# End remoteBuilds tests
|
||||
|
||||
remoteBuildsSshNg = runNixOSTestFor "x86_64-linux" ./remote-builds-ssh-ng.nix;
|
||||
|
||||
# Test our Nix as a client against remotes that are older
|
||||
|
||||
remoteBuildsSshNg_remote_2_3 = runNixOSTestFor "x86_64-linux" {
|
||||
name = "remoteBuildsSshNg_remote_2_3";
|
||||
imports = [ ./remote-builds-ssh-ng.nix ];
|
||||
builders.config = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3;
|
||||
};
|
||||
};
|
||||
|
||||
remoteBuildsSshNg_remote_2_13 = runNixOSTestFor "x86_64-linux" {
|
||||
name = "remoteBuildsSshNg_remote_2_13";
|
||||
imports = [ ./remote-builds-ssh-ng.nix ];
|
||||
builders.config = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_13;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: (nixpkgs update) remoteBuildsSshNg_remote_2_18 = ...
|
||||
|
||||
# Test our Nix as a builder for clients that are older
|
||||
|
||||
# FIXME: these tests don't work yet
|
||||
/*
|
||||
remoteBuildsSshNg_local_2_3 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: {
|
||||
name = "remoteBuildsSshNg_local_2_3";
|
||||
imports = [ ./remote-builds-ssh-ng.nix ];
|
||||
nodes.client = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3;
|
||||
};
|
||||
});
|
||||
|
||||
remoteBuildsSshNg_local_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: {
|
||||
name = "remoteBuildsSshNg_local_2_13";
|
||||
imports = [ ./remote-builds-ssh-ng.nix ];
|
||||
nodes.client = { lib, pkgs, ... }: {
|
||||
imports = [ checkOverrideNixVersion ];
|
||||
nix.package = lib.mkForce pkgs.nixVersions.nix_2_13;
|
||||
};
|
||||
});
|
||||
|
||||
# TODO: (nixpkgs update) remoteBuildsSshNg_local_2_18 = ...
|
||||
*/
|
||||
|
||||
nix-copy-closure = runNixOSTestFor "x86_64-linux" ./nix-copy-closure.nix;
|
||||
|
||||
nix-copy = runNixOSTestFor "x86_64-linux" ./nix-copy.nix;
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ config, lib, hostPkgs, ... }:
|
||||
test@{ config, lib, hostPkgs, ... }:
|
||||
|
||||
let
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
@ -28,12 +28,26 @@ let
|
||||
in
|
||||
|
||||
{
|
||||
name = "remote-builds-ssh-ng";
|
||||
options = {
|
||||
builders.config = lib.mkOption {
|
||||
type = lib.types.deferredModule;
|
||||
description = ''
|
||||
Configuration to add to the builder nodes.
|
||||
'';
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
name = lib.mkDefault "remote-builds-ssh-ng";
|
||||
|
||||
nodes =
|
||||
{ builder =
|
||||
{
|
||||
builder =
|
||||
{ config, pkgs, ... }:
|
||||
{ services.openssh.enable = true;
|
||||
{
|
||||
imports = [ test.config.builders.config ];
|
||||
services.openssh.enable = true;
|
||||
virtualisation.writableStore = true;
|
||||
nix.settings.sandbox = true;
|
||||
nix.settings.substituters = lib.mkForce [ ];
|
||||
@ -41,17 +55,18 @@ in
|
||||
|
||||
client =
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ nix.settings.max-jobs = 0; # force remote building
|
||||
{
|
||||
nix.settings.max-jobs = 0; # force remote building
|
||||
nix.distributedBuilds = true;
|
||||
nix.buildMachines =
|
||||
[ { hostName = "builder";
|
||||
[{
|
||||
hostName = "builder";
|
||||
sshUser = "root";
|
||||
sshKey = "/root/.ssh/id_ed25519";
|
||||
system = "i686-linux";
|
||||
maxJobs = 1;
|
||||
protocol = "ssh-ng";
|
||||
}
|
||||
];
|
||||
}];
|
||||
virtualisation.writableStore = true;
|
||||
virtualisation.additionalPaths = [ config.system.build.extraUtils ];
|
||||
nix.settings.substituters = lib.mkForce [ ];
|
||||
@ -105,4 +120,5 @@ in
|
||||
# Check that we get phase reporting in the log file
|
||||
client.succeed("grep -q '@nix {\"action\":\"setPhase\",\"phase\":\"buildPhase\"}' log-output")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Test Nix's remote build feature.
|
||||
|
||||
{ config, lib, hostPkgs, ... }:
|
||||
test@{ config, lib, hostPkgs, ... }:
|
||||
|
||||
let
|
||||
pkgs = config.nodes.client.nixpkgs.pkgs;
|
||||
@ -8,7 +8,9 @@ let
|
||||
# The configuration of the remote builders.
|
||||
builder =
|
||||
{ config, pkgs, ... }:
|
||||
{ services.openssh.enable = true;
|
||||
{
|
||||
imports = [ test.config.builders.config ];
|
||||
services.openssh.enable = true;
|
||||
virtualisation.writableStore = true;
|
||||
nix.settings.sandbox = true;
|
||||
|
||||
@ -35,24 +37,40 @@ let
|
||||
in
|
||||
|
||||
{
|
||||
name = "remote-builds";
|
||||
options = {
|
||||
builders.config = lib.mkOption {
|
||||
type = lib.types.deferredModule;
|
||||
description = ''
|
||||
Configuration to add to the builder nodes.
|
||||
'';
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
name = lib.mkDefault "remote-builds";
|
||||
|
||||
nodes =
|
||||
{ builder1 = builder;
|
||||
{
|
||||
builder1 = builder;
|
||||
builder2 = builder;
|
||||
|
||||
client =
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ nix.settings.max-jobs = 0; # force remote building
|
||||
{
|
||||
nix.settings.max-jobs = 0; # force remote building
|
||||
nix.distributedBuilds = true;
|
||||
nix.buildMachines =
|
||||
[ { hostName = "builder1";
|
||||
[
|
||||
{
|
||||
hostName = "builder1";
|
||||
sshUser = "root";
|
||||
sshKey = "/root/.ssh/id_ed25519";
|
||||
system = "i686-linux";
|
||||
maxJobs = 1;
|
||||
}
|
||||
{ hostName = "builder2";
|
||||
{
|
||||
hostName = "builder2";
|
||||
sshUser = "root";
|
||||
sshKey = "/root/.ssh/id_ed25519";
|
||||
system = "i686-linux";
|
||||
@ -108,4 +126,5 @@ in
|
||||
builder1.block()
|
||||
client.succeed("nix-build ${expr nodes.client 4}")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user