aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/nixos/default.nix100
-rw-r--r--tests/nixos/remote-builds-ssh-ng.nix21
-rw-r--r--tests/nixos/remote-builds.nix21
3 files changed, 136 insertions, 6 deletions
diff --git a/tests/nixos/default.nix b/tests/nixos/default.nix
index 4c1cf785c..f2873f80e 100644
--- a/tests/nixos/default.nix
+++ b/tests/nixos/default.nix
@@ -14,6 +14,13 @@ let
_module.args.nixpkgs = nixpkgs;
};
+ # 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
{
@@ -21,8 +28,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;
diff --git a/tests/nixos/remote-builds-ssh-ng.nix b/tests/nixos/remote-builds-ssh-ng.nix
index b59dde9bf..c75ad7253 100644
--- a/tests/nixos/remote-builds-ssh-ng.nix
+++ b/tests/nixos/remote-builds-ssh-ng.nix
@@ -1,4 +1,4 @@
-{ config, lib, hostPkgs, ... }:
+test@{ config, lib, hostPkgs, ... }:
let
pkgs = config.nodes.client.nixpkgs.pkgs;
@@ -28,12 +28,27 @@ let
in
{
- name = "remote-builds-ssh-ng";
+ name = lib.mkDefault "remote-builds-ssh-ng";
+
+ # TODO expand module shorthand syntax instead of use imports
+ imports = [{
+ options = {
+ builders.config = lib.mkOption {
+ type = lib.types.deferredModule;
+ description = ''
+ Configuration to add to the builder nodes.
+ '';
+ default = { };
+ };
+ };
+ }];
nodes =
{ 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 [ ];
diff --git a/tests/nixos/remote-builds.nix b/tests/nixos/remote-builds.nix
index 1c96cc787..eae1ccd88 100644
--- a/tests/nixos/remote-builds.nix
+++ b/tests/nixos/remote-builds.nix
@@ -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,7 +37,20 @@ let
in
{
- name = "remote-builds";
+ name = lib.mkDefault "remote-builds";
+
+ # TODO expand module shorthand syntax instead of use imports
+ imports = [{
+ options = {
+ builders.config = lib.mkOption {
+ type = lib.types.deferredModule;
+ description = ''
+ Configuration to add to the builder nodes.
+ '';
+ default = { };
+ };
+ };
+ }];
nodes =
{ builder1 = builder;