aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-03-16 13:43:08 +0100
committerregnat <rg@regnat.ovh>2021-03-16 14:21:39 +0100
commita0866c8ea4bc66f9aacc7ad19139d57946b3df18 (patch)
treee3e7f8bc27a6e395ceccae84c1bd5948a21c5df9 /flake.nix
parenteab9cdbd75e739be33f9433cfba9ab354d084440 (diff)
Make the tests (optionnally) run in another derivation
That way we can run them without rebuilding Nix
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix41
1 files changed, 36 insertions, 5 deletions
diff --git a/flake.nix b/flake.nix
index 3e236aaca..c2e5db53a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -144,6 +144,32 @@
echo "file installer $out/install" >> $out/nix-support/hydra-build-products
'';
+ testNixVersions = pkgs: client: daemon: with commonDeps pkgs; pkgs.stdenv.mkDerivation {
+ NIX_DAEMON_PACKAGE = daemon;
+ NIX_CLIENT_PACKAGE = client;
+ name = "nix-tests-${client.version}-against-${daemon.version}";
+ inherit version;
+
+ src = self;
+
+ VERSION_SUFFIX = versionSuffix;
+
+ nativeBuildInputs = nativeBuildDeps;
+ buildInputs = buildDeps ++ awsDeps;
+ propagatedBuildInputs = propagatedDeps;
+
+ enableParallelBuilding = true;
+
+ dontBuild = true;
+ doInstallCheck = true;
+
+ installPhase = ''
+ mkdir -p $out
+ '';
+ installCheckPhase = "make installcheck";
+
+ };
+
in {
# A Nixpkgs overlay that overrides the 'nix' and
@@ -153,7 +179,7 @@
# An older version of Nix to test against when using the daemon.
# Currently using `nixUnstable` as the stable one doesn't respect
# `NIX_DAEMON_SOCKET_PATH` which is needed for the tests.
- mainstream-nix = prev.nixUnstable;
+ nixStable = prev.nix;
nix = with final; with commonDeps pkgs; stdenv.mkDerivation {
name = "nix-${version}";
@@ -163,8 +189,6 @@
VERSION_SUFFIX = versionSuffix;
- OUTER_NIX = mainstream-nix;
-
outputs = [ "out" "dev" "doc" ];
nativeBuildInputs = nativeBuildDeps;
@@ -441,6 +465,15 @@
checks = forAllSystems (system: {
binaryTarball = self.hydraJobs.binaryTarball.${system};
perlBindings = self.hydraJobs.perlBindings.${system};
+ installTests =
+ let pkgs = nixpkgsFor.${system}; in
+ pkgs.runCommand "install-tests" {
+ againstSelf = testNixVersions pkgs pkgs.nix pkgs.pkgs.nix;
+ againstCurrentUnstable = testNixVersions pkgs pkgs.nix pkgs.nixUnstable;
+ # Disabled because the latest stable version doesn't handle
+ # `NIX_DAEMON_SOCKET_PATH` which is required for the tests to work
+ # againstLatestStable = testNixVersions pkgs pkgs.nix pkgs.nixStable;
+ } "touch $out";
});
packages = forAllSystems (system: {
@@ -493,8 +526,6 @@
stdenv.mkDerivation {
name = "nix";
- OUTER_NIX = mainstream-nix;
-
outputs = [ "out" "dev" "doc" ];
nativeBuildInputs = nativeBuildDeps;