hydra.nix Can just return the obj for that name

This commit is contained in:
John Ericson 2024-05-31 18:27:20 -04:00
parent 1c46b9b2c5
commit 300b129fc7
2 changed files with 130 additions and 132 deletions

View file

@ -34,155 +34,153 @@ let
}; };
in in
{ {
hydraJobs = { # Binary package for various platforms.
# Binary package for various platforms. build = forAllSystems (system: self.packages.${system}.nix);
build = forAllSystems (system: self.packages.${system}.nix);
shellInputs = forAllSystems (system: self.devShells.${system}.default.inputDerivation); shellInputs = forAllSystems (system: self.devShells.${system}.default.inputDerivation);
buildStatic = lib.genAttrs linux64BitSystems (system: self.packages.${system}.nix-static); buildStatic = lib.genAttrs linux64BitSystems (system: self.packages.${system}.nix-static);
buildCross = forAllCrossSystems (crossSystem: buildCross = forAllCrossSystems (crossSystem:
lib.genAttrs [ "x86_64-linux" ] (system: self.packages.${system}."nix-${crossSystem}")); lib.genAttrs [ "x86_64-linux" ] (system: self.packages.${system}."nix-${crossSystem}"));
buildNoGc = forAllSystems (system: buildNoGc = forAllSystems (system:
self.packages.${system}.nix.override { enableGC = false; } self.packages.${system}.nix.override { enableGC = false; }
); );
buildNoTests = forAllSystems (system: buildNoTests = forAllSystems (system:
self.packages.${system}.nix.override { self.packages.${system}.nix.override {
doCheck = false; doCheck = false;
doInstallCheck = false; doInstallCheck = false;
installUnitTests = false; installUnitTests = false;
} }
); );
# Toggles some settings for better coverage. Windows needs these # Toggles some settings for better coverage. Windows needs these
# library combinations, and Debian build Nix with GNU readline too. # library combinations, and Debian build Nix with GNU readline too.
buildReadlineNoMarkdown = forAllSystems (system: buildReadlineNoMarkdown = forAllSystems (system:
self.packages.${system}.nix.override { self.packages.${system}.nix.override {
enableMarkdown = false; enableMarkdown = false;
readlineFlavor = "readline"; readlineFlavor = "readline";
} }
); );
# Perl bindings for various platforms. # Perl bindings for various platforms.
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nix.perl-bindings); perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nix.perl-bindings);
# Binary tarball for various platforms, containing a Nix store # Binary tarball for various platforms, containing a Nix store
# with the closure of 'nix' package, and the second half of # with the closure of 'nix' package, and the second half of
# the installation script. # the installation script.
binaryTarball = forAllSystems (system: binaryTarball nixpkgsFor.${system}.native.nix nixpkgsFor.${system}.native); binaryTarball = forAllSystems (system: binaryTarball nixpkgsFor.${system}.native.nix nixpkgsFor.${system}.native);
binaryTarballCross = lib.genAttrs [ "x86_64-linux" ] (system: binaryTarballCross = lib.genAttrs [ "x86_64-linux" ] (system:
forAllCrossSystems (crossSystem: forAllCrossSystems (crossSystem:
binaryTarball binaryTarball
self.packages.${system}."nix-${crossSystem}" self.packages.${system}."nix-${crossSystem}"
nixpkgsFor.${system}.cross.${crossSystem})); nixpkgsFor.${system}.cross.${crossSystem}));
# The first half of the installation script. This is uploaded # The first half of the installation script. This is uploaded
# to https://nixos.org/nix/install. It downloads the binary # to https://nixos.org/nix/install. It downloads the binary
# tarball for the user's system and calls the second half of the # tarball for the user's system and calls the second half of the
# installation script. # installation script.
installerScript = installScriptFor [ installerScript = installScriptFor [
# Native # Native
self.hydraJobs.binaryTarball."x86_64-linux" self.hydraJobs.binaryTarball."x86_64-linux"
self.hydraJobs.binaryTarball."i686-linux" self.hydraJobs.binaryTarball."i686-linux"
self.hydraJobs.binaryTarball."aarch64-linux" self.hydraJobs.binaryTarball."aarch64-linux"
self.hydraJobs.binaryTarball."x86_64-darwin" self.hydraJobs.binaryTarball."x86_64-darwin"
self.hydraJobs.binaryTarball."aarch64-darwin" self.hydraJobs.binaryTarball."aarch64-darwin"
# Cross # Cross
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf" self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf" self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."riscv64-unknown-linux-gnu" self.hydraJobs.binaryTarballCross."x86_64-linux"."riscv64-unknown-linux-gnu"
]; ];
installerScriptForGHA = installScriptFor [ installerScriptForGHA = installScriptFor [
# Native # Native
self.hydraJobs.binaryTarball."x86_64-linux" self.hydraJobs.binaryTarball."x86_64-linux"
self.hydraJobs.binaryTarball."x86_64-darwin" self.hydraJobs.binaryTarball."x86_64-darwin"
# Cross # Cross
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf" self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf" self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."riscv64-unknown-linux-gnu" self.hydraJobs.binaryTarballCross."x86_64-linux"."riscv64-unknown-linux-gnu"
]; ];
# docker image with Nix inside # docker image with Nix inside
dockerImage = lib.genAttrs linux64BitSystems (system: self.packages.${system}.dockerImage); dockerImage = lib.genAttrs linux64BitSystems (system: self.packages.${system}.dockerImage);
# Line coverage analysis. # Line coverage analysis.
coverage = nixpkgsFor.x86_64-linux.native.nix.override { coverage = nixpkgsFor.x86_64-linux.native.nix.override {
pname = "nix-coverage"; pname = "nix-coverage";
withCoverageChecks = true; withCoverageChecks = true;
}; };
# API docs for Nix's unstable internal C++ interfaces. # API docs for Nix's unstable internal C++ interfaces.
internal-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix { internal-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix {
inherit fileset; inherit fileset;
doBuild = false; doBuild = false;
enableInternalAPIDocs = true; enableInternalAPIDocs = true;
}; };
# API docs for Nix's C bindings. # API docs for Nix's C bindings.
external-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix { external-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix {
inherit fileset; inherit fileset;
doBuild = false; doBuild = false;
enableExternalAPIDocs = true; enableExternalAPIDocs = true;
}; };
# System tests. # System tests.
tests = import ../tests/nixos { inherit lib nixpkgs nixpkgsFor; } // { tests = import ../tests/nixos { inherit lib nixpkgs nixpkgsFor; } // {
# Make sure that nix-env still produces the exact same result # Make sure that nix-env still produces the exact same result
# on a particular version of Nixpkgs. # on a particular version of Nixpkgs.
evalNixpkgs = evalNixpkgs =
let let
inherit (nixpkgsFor.x86_64-linux.native) runCommand nix; inherit (nixpkgsFor.x86_64-linux.native) runCommand nix;
in in
runCommand "eval-nixos" { buildInputs = [ nix ]; } runCommand "eval-nixos" { buildInputs = [ nix ]; }
'' ''
type -p nix-env type -p nix-env
# Note: we're filtering out nixos-install-tools because https://github.com/NixOS/nixpkgs/pull/153594#issuecomment-1020530593. # Note: we're filtering out nixos-install-tools because https://github.com/NixOS/nixpkgs/pull/153594#issuecomment-1020530593.
( (
set -x set -x
time nix-env --store dummy:// -f ${nixpkgs-regression} -qaP --drv-path | sort | grep -v nixos-install-tools > packages time nix-env --store dummy:// -f ${nixpkgs-regression} -qaP --drv-path | sort | grep -v nixos-install-tools > packages
[[ $(sha1sum < packages | cut -c1-40) = e01b031fc9785a572a38be6bc473957e3b6faad7 ]] [[ $(sha1sum < packages | cut -c1-40) = e01b031fc9785a572a38be6bc473957e3b6faad7 ]]
) )
mkdir $out mkdir $out
''; '';
nixpkgsLibTests = nixpkgsLibTests =
forAllSystems (system: forAllSystems (system:
import (nixpkgs + "/lib/tests/release.nix") import (nixpkgs + "/lib/tests/release.nix")
{ {
pkgs = nixpkgsFor.${system}.native; pkgs = nixpkgsFor.${system}.native;
nixVersions = [ self.packages.${system}.nix ]; nixVersions = [ self.packages.${system}.nix ];
} }
); );
}; };
metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" { metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" {
pkgs = nixpkgsFor.x86_64-linux.native; pkgs = nixpkgsFor.x86_64-linux.native;
nixpkgs = nixpkgs-regression; nixpkgs = nixpkgs-regression;
}; };
installTests = forAllSystems (system: installTests = forAllSystems (system:
let pkgs = nixpkgsFor.${system}.native; in let pkgs = nixpkgsFor.${system}.native; in
pkgs.runCommand "install-tests" pkgs.runCommand "install-tests"
{ {
againstSelf = testNixVersions pkgs pkgs.nix pkgs.pkgs.nix; againstSelf = testNixVersions pkgs pkgs.nix pkgs.pkgs.nix;
againstCurrentUnstable = againstCurrentUnstable =
# FIXME: temporarily disable this on macOS because of #3605. # FIXME: temporarily disable this on macOS because of #3605.
if system == "x86_64-linux" if system == "x86_64-linux"
then testNixVersions pkgs pkgs.nix pkgs.nixUnstable then testNixVersions pkgs pkgs.nix pkgs.nixUnstable
else null; else null;
# Disabled because the latest stable version doesn't handle # Disabled because the latest stable version doesn't handle
# `NIX_DAEMON_SOCKET_PATH` which is required for the tests to work # `NIX_DAEMON_SOCKET_PATH` which is required for the tests to work
# againstLatestStable = testNixVersions pkgs pkgs.nix pkgs.nixStable; # againstLatestStable = testNixVersions pkgs pkgs.nix pkgs.nixStable;
} "touch $out"); } "touch $out");
installerTests = import ../tests/installer { installerTests = import ../tests/installer {
binaryTarballs = self.hydraJobs.binaryTarball; binaryTarballs = self.hydraJobs.binaryTarball;
inherit nixpkgsFor; inherit nixpkgsFor;
};
}; };
} }

View file

@ -210,7 +210,7 @@
# 'nix.perl-bindings' packages. # 'nix.perl-bindings' packages.
overlays.default = overlayFor (p: p.stdenv); overlays.default = overlayFor (p: p.stdenv);
inherit (import ./build/hydra.nix { hydraJobs = import ./build/hydra.nix {
inherit inherit
inputs inputs
binaryTarball binaryTarball
@ -221,7 +221,7 @@
nixpkgsFor nixpkgsFor
self self
; ;
}) hydraJobs; };
checks = forAllSystems (system: { checks = forAllSystems (system: {
binaryTarball = self.hydraJobs.binaryTarball.${system}; binaryTarball = self.hydraJobs.binaryTarball.${system};