diff --git a/flake.nix b/flake.nix index ddc98c48a..0b6197512 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,7 @@ nix_2_18 nix2container lixSrc + nixpkgs-regression ; }; @@ -96,7 +97,6 @@ forAvailableSystems linux64BitSystems nixpkgsFor - nonDarwinSystems officialRelease overlayFor systems @@ -105,6 +105,7 @@ inherit (scope.callPackage ./nix-support/build/outputs.nix { }) packages + tests ; in { @@ -231,85 +232,7 @@ doInstallCheck = false; }); - # System tests. - tests = - import ./tests/nixos { - inherit - lib - nixpkgs - nixpkgsFor - ; - } - // { - # the n-e-j test suite is unusably slow in darwin ci. disbled until anywho fixes this. - nix-eval-jobs = (lib.genAttrs nonDarwinSystems) ( - system: self.packages.${system}.nix-eval-jobs.tests.nix-eval-jobs - ); - - # This is x86_64-linux only, just because we have significantly - # cheaper x86_64-linux compute in CI. - # It is clangStdenv because clang's sanitizers are nicer. - asanBuild = self.packages.x86_64-linux.nix-clangStdenv.override { - # Improve caching of non-code changes by not changing the - # derivation name every single time, since this will never be seen - # by users anyway. - versionSuffix = ""; - sanitize = [ - "address" - "undefined" - ]; - # it is very hard to make *every* CI build use this option such - # that we don't wind up building Lix twice, so we do it here where - # we are already doing so. - werror = true; - }; - - # Although this might be nicer to do with pre-commit, that would - # require adding 12MB of nodejs to the dev shell, whereas building it - # in CI with Nix avoids that at a cost of slower feedback on rarely - # touched files. - jsSyntaxCheck = - let - nixpkgs = nixpkgsFor.x86_64-linux.native; - inherit (nixpkgs) pkgs; - docSources = lib.fileset.toSource { - root = ./doc; - fileset = lib.fileset.fileFilter (f: f.hasExt "js") ./doc; - }; - in - pkgs.runCommand "js-syntax-check" { } '' - find ${docSources} -type f -print -exec ${pkgs.nodejs-slim}/bin/node --check '{}' ';' - touch $out - ''; - - # clang-tidy run against the Lix codebase using the Lix clang-tidy plugin - clang-tidy = forAllSystems ( - system: - let - pkgs = nixpkgsFor.${system}.native; - in - pkgs.callPackage ./package.nix { - # Required since we don't support gcc stdenv - stdenv = pkgs.clangStdenv; - versionSuffix = ""; - lintInsteadOfBuild = true; - } - ); - - # Make sure that nix-env still produces the exact same result - # on a particular version of Nixpkgs. - evalNixpkgs = nixpkgsFor.x86_64-linux.native.callPackage ./tests/nixpkgs/eval.nix { - inherit nixpkgs-regression; - }; - - nixpkgsLibTests = forAllSystems ( - system: - nixpkgsFor.${system}.native.callPackage ./tests/nixpkgs/lib.nix { - inherit nixpkgs system; - inherit (self.packages.${system}) nix; - } - ); - }; + inherit tests; pre-commit = forAvailableSystems ( system: diff --git a/nix-support/build/inputs.nix b/nix-support/build/inputs.nix index 43c59a27d..ee8c13a86 100644 --- a/nix-support/build/inputs.nix +++ b/nix-support/build/inputs.nix @@ -4,6 +4,7 @@ nixpkgs, nix_2_18, nix2container, + nixpkgs-regression, }: let @@ -211,7 +212,7 @@ let }); }; - inherit nix2container nixpkgs; + inherit nix2container nixpkgs nixpkgs-regression; }); in sc diff --git a/nix-support/build/outputs.nix b/nix-support/build/outputs.nix index 74adef1ca..e40f916bd 100644 --- a/nix-support/build/outputs.nix +++ b/nix-support/build/outputs.nix @@ -6,9 +6,12 @@ stdenvs, lib, nix2container, + nixpkgs, + nonDarwinSystems, + nixpkgs-regression, }: -{ +lib.fix (self: { packages = forAllSystems ( system: rec { @@ -48,4 +51,84 @@ ) ) ); -} + + # System tests. + tests = + import ../../tests/nixos { + inherit + lib + nixpkgs + nixpkgsFor + ; + } + // { + # the n-e-j test suite is unusably slow in darwin ci. disbled until anywho fixes this. + nix-eval-jobs = (lib.genAttrs nonDarwinSystems) ( + system: self.packages.${system}.nix-eval-jobs.tests.nix-eval-jobs + ); + + # This is x86_64-linux only, just because we have significantly + # cheaper x86_64-linux compute in CI. + # It is clangStdenv because clang's sanitizers are nicer. + asanBuild = self.packages.x86_64-linux.nix-clangStdenv.override { + # Improve caching of non-code changes by not changing the + # derivation name every single time, since this will never be seen + # by users anyway. + versionSuffix = ""; + sanitize = [ + "address" + "undefined" + ]; + # it is very hard to make *every* CI build use this option such + # that we don't wind up building Lix twice, so we do it here where + # we are already doing so. + werror = true; + }; + + # Although this might be nicer to do with pre-commit, that would + # require adding 12MB of nodejs to the dev shell, whereas building it + # in CI with Nix avoids that at a cost of slower feedback on rarely + # touched files. + jsSyntaxCheck = + let + nixpkgs = nixpkgsFor.x86_64-linux.native; + inherit (nixpkgs) pkgs; + docSources = lib.fileset.toSource { + root = ../../doc; + fileset = lib.fileset.fileFilter (f: f.hasExt "js") ../../doc; + }; + in + pkgs.runCommand "js-syntax-check" { } '' + find ${docSources} -type f -print -exec ${pkgs.nodejs-slim}/bin/node --check '{}' ';' + touch $out + ''; + + # clang-tidy run against the Lix codebase using the Lix clang-tidy plugin + clang-tidy = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}.native; + in + pkgs.callPackage ../../package.nix { + # Required since we don't support gcc stdenv + stdenv = pkgs.clangStdenv; + versionSuffix = ""; + lintInsteadOfBuild = true; + } + ); + + # Make sure that nix-env still produces the exact same result + # on a particular version of Nixpkgs. + evalNixpkgs = nixpkgsFor.x86_64-linux.native.callPackage ../../tests/nixpkgs/eval.nix { + inherit nixpkgs-regression; + }; + + nixpkgsLibTests = forAllSystems ( + system: + nixpkgsFor.${system}.native.callPackage ../../tests/nixpkgs/lib.nix { + inherit nixpkgs system; + inherit (self.packages.${system}) nix; + } + ); + }; +})