Skip to content

Commit

Permalink
Test against stable versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Nov 16, 2021
1 parent 9fe0343 commit f8f94e2
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 20 deletions.
72 changes: 71 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 29 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

inputs.nixpkgs.url = "nixpkgs/nixos-21.05-small";
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
inputs.nix-2_3-src = { url = "github:nixos/nix/2.3-maintenance"; flake = false; };
inputs.nix-2_4 = { url = "github:nixos/nix/2.4-maintenance"; };

outputs = { self, nixpkgs, lowdown-src }:
outputs = { self, nixpkgs, lowdown-src, nix-2_3-src, nix-2_4 }:

let

Expand Down Expand Up @@ -156,12 +158,7 @@
testNixVersions = pkgs: client: daemon: with commonDeps pkgs; with pkgs.lib; pkgs.stdenv.mkDerivation {
NIX_DAEMON_PACKAGE = daemon;
NIX_CLIENT_PACKAGE = client;
name =
"nix-tests"
+ optionalString
(versionAtLeast daemon.version "2.4pre20211005" &&
versionAtLeast client.version "2.4pre20211005")
"-${client.version}-against-${daemon.version}";
name = "nix-tests-${client.version}-against-${daemon.version}";
inherit version;

src = self;
Expand Down Expand Up @@ -489,20 +486,33 @@
'';
*/

installTests = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in
pkgs.runCommand "install-tests" {
againstSelf = testNixVersions pkgs pkgs.nix pkgs.pkgs.nix;
againstCurrentUnstable =
installTests = let
inherit (nixpkgs) lib;
forAllPkgs = f: forAllSystems (system: f nixpkgsFor.${system});
allTests = rec {
againstSelf = forAllPkgs (pkgs: testNixVersions pkgs pkgs.nix pkgs.pkgs.nix);
againstCurrentUnstable = forAllPkgs (pkgs:
# FIXME: temporarily disable this on macOS because of #3605.
if system == "x86_64-linux"
if pkgs.stdenv.hostPlatform.system == "x86_64-linux"
then testNixVersions pkgs pkgs.nix pkgs.nixUnstable
else null;
# 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");

else null);
foo = "${nix-2_3-src}/release.nix";
againstStable_2_3 = forAllPkgs (pkgs: testNixVersions pkgs pkgs.nix
(let
pkg = (import "${nix-2_3-src}/release.nix" {
nix = nix-2_3-src;
inherit nixpkgs;
officialRelease = true;
}).build.${pkgs.stdenv.hostPlatform.system};
in pkg // {
inherit (lib.strings.parseDrvName pkg.name) version;
}));
againstStable_2_4 = forAllPkgs (pkgs: testNixVersions pkgs pkgs.nix
nix-2_4.packages.${pkgs.stdenv.hostPlatform.system}.nix);
};
all = forAllSystems (system:
nixpkgsFor.${systems}.runCommand "install-tests" (lib.mapAttrs (_: v: v.${system})) "touch $out");
in allTests // { inherit all; };
};

checks = forAllSystems (system: {
Expand Down

0 comments on commit f8f94e2

Please sign in to comment.