From f8f94e2266420fc048ef76db44ba49b58841bcfe Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 16 Nov 2021 05:41:33 +0000 Subject: [PATCH] Test against stable versions --- flake.lock | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 48 ++++++++++++++++++++++-------------- 2 files changed, 100 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index 861af1c548e1..47ebf1929efc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,22 @@ { "nodes": { "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1636919659, + "narHash": "sha256-ObxiZXE8dy1ki8DmioHm8cwmDgGzv7+Mb605nY/q0wU=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "491074e34d354742e8b6b9c858df8edcf77fa063", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "lowdown-src_2": { "flake": false, "locked": { "lastModified": 1633514407, @@ -16,6 +32,43 @@ "type": "github" } }, + "nix-2_3-src": { + "flake": false, + "locked": { + "lastModified": 1636377492, + "narHash": "sha256-QX3+Ga90t5Ox3nyxU8INU10Wj4MBRtfWe/JjcvaAnx0=", + "owner": "nixos", + "repo": "nix", + "rev": "cad762e2d113c42520477392f2adca30832f6c03", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "2.3-maintenance", + "repo": "nix", + "type": "github" + } + }, + "nix-2_4": { + "inputs": { + "lowdown-src": "lowdown-src_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1636114943, + "narHash": "sha256-Jzz7qWP6huKDBUopAyOLjmPXpikMedJ8VE5Q0cWpUYU=", + "owner": "nixos", + "repo": "nix", + "rev": "8d12084707be9da7a03a33e8de95766854818fcb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "2.4-maintenance", + "repo": "nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1632864508, @@ -31,10 +84,27 @@ "type": "indirect" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1637014346, + "narHash": "sha256-3yk73EWKUv6hNkDQDYn3Z8MJJqkMB9k8ju2nXzyejZg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c83297105d17cd73d15e3671af2e71f809ad8e76", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05-small", + "type": "indirect" + } + }, "root": { "inputs": { "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs" + "nix-2_3-src": "nix-2_3-src", + "nix-2_4": "nix-2_4", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index ed622ec86e2e..5ea49078afa4 100644 --- a/flake.nix +++ b/flake.nix @@ -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 @@ -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; @@ -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: {