2024-05-31 20:12:35 +03:00
|
|
|
{ inputs
|
|
|
|
, binaryTarball
|
|
|
|
, forAllCrossSystems
|
|
|
|
, forAllSystems
|
|
|
|
, lib
|
|
|
|
, linux64BitSystems
|
|
|
|
, nixpkgsFor
|
|
|
|
, self
|
2024-08-13 23:15:56 +03:00
|
|
|
, officialRelease
|
2024-05-31 20:12:35 +03:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
inherit (inputs) nixpkgs nixpkgs-regression;
|
2024-05-31 21:37:58 +03:00
|
|
|
|
|
|
|
installScriptFor = tarballs:
|
2024-06-01 00:27:14 +03:00
|
|
|
nixpkgsFor.x86_64-linux.native.callPackage ../scripts/installer.nix {
|
2024-05-31 21:37:58 +03:00
|
|
|
inherit tarballs;
|
|
|
|
};
|
|
|
|
|
2024-11-04 19:15:41 +02:00
|
|
|
testNixVersions = pkgs: daemon:
|
|
|
|
pkgs.nixComponents.nix-functional-tests.override {
|
2024-05-31 21:37:58 +03:00
|
|
|
pname =
|
|
|
|
"nix-tests"
|
|
|
|
+ lib.optionalString
|
|
|
|
(lib.versionAtLeast daemon.version "2.4pre20211005" &&
|
2024-11-04 19:15:41 +02:00
|
|
|
lib.versionAtLeast pkgs.nix.version "2.4pre20211005")
|
|
|
|
"-${pkgs.nix.version}-against-${daemon.version}";
|
2024-05-31 21:37:58 +03:00
|
|
|
|
|
|
|
test-daemon = daemon;
|
|
|
|
};
|
2024-06-04 16:28:27 +03:00
|
|
|
|
2024-06-26 03:44:21 +03:00
|
|
|
# Technically we could just return `pkgs.nixComponents`, but for Hydra it's
|
|
|
|
# convention to transpose it, and to transpose it efficiently, we need to
|
|
|
|
# enumerate them manually, so that we don't evaluate unnecessary package sets.
|
2024-06-04 16:28:27 +03:00
|
|
|
forAllPackages = lib.genAttrs [
|
2024-11-07 14:46:37 +02:00
|
|
|
"nix"
|
2024-06-04 16:28:27 +03:00
|
|
|
"nix-util"
|
2024-06-25 16:35:47 +03:00
|
|
|
"nix-util-c"
|
|
|
|
"nix-util-test-support"
|
2024-06-29 17:31:08 +03:00
|
|
|
"nix-util-tests"
|
2024-06-04 16:28:27 +03:00
|
|
|
"nix-store"
|
2024-06-28 01:24:49 +03:00
|
|
|
"nix-store-c"
|
|
|
|
"nix-store-test-support"
|
2024-06-29 17:31:08 +03:00
|
|
|
"nix-store-tests"
|
2024-06-06 04:36:18 +03:00
|
|
|
"nix-fetchers"
|
2024-06-29 17:31:08 +03:00
|
|
|
"nix-fetchers-tests"
|
2024-06-28 01:24:49 +03:00
|
|
|
"nix-expr"
|
|
|
|
"nix-expr-c"
|
|
|
|
"nix-expr-test-support"
|
2024-06-29 17:31:08 +03:00
|
|
|
"nix-expr-tests"
|
2024-06-28 01:24:49 +03:00
|
|
|
"nix-flake"
|
2024-06-29 17:31:08 +03:00
|
|
|
"nix-flake-tests"
|
2024-07-03 21:47:23 +03:00
|
|
|
"nix-main"
|
2024-07-02 22:15:17 +03:00
|
|
|
"nix-main-c"
|
2024-07-03 21:47:23 +03:00
|
|
|
"nix-cmd"
|
2024-08-14 23:04:35 +03:00
|
|
|
"nix-cli"
|
2024-07-08 23:07:06 +03:00
|
|
|
"nix-functional-tests"
|
2024-11-07 14:46:37 +02:00
|
|
|
"nix-ng"
|
2024-06-04 16:28:27 +03:00
|
|
|
];
|
2024-05-31 20:12:35 +03:00
|
|
|
in
|
|
|
|
{
|
2024-06-01 01:27:20 +03:00
|
|
|
# Binary package for various platforms.
|
2024-06-17 15:29:02 +03:00
|
|
|
build = forAllPackages (pkgName:
|
2024-06-26 03:44:21 +03:00
|
|
|
forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.${pkgName}));
|
2024-06-01 01:27:20 +03:00
|
|
|
|
2024-11-08 14:14:43 +02:00
|
|
|
shellInputs = removeAttrs
|
|
|
|
(forAllSystems (system: self.devShells.${system}.default.inputDerivation))
|
|
|
|
[ "i686-linux" ];
|
2024-06-01 01:27:20 +03:00
|
|
|
|
2024-06-04 16:28:27 +03:00
|
|
|
buildStatic = forAllPackages (pkgName:
|
2024-06-26 03:44:21 +03:00
|
|
|
lib.genAttrs linux64BitSystems (system: nixpkgsFor.${system}.static.nixComponents.${pkgName}));
|
2024-06-01 01:27:20 +03:00
|
|
|
|
2024-06-04 16:28:27 +03:00
|
|
|
buildCross = forAllPackages (pkgName:
|
2024-07-08 23:07:06 +03:00
|
|
|
# Hack to avoid non-evaling package
|
|
|
|
(if pkgName == "nix-functional-tests" then lib.flip builtins.removeAttrs ["x86_64-w64-mingw32"] else lib.id)
|
|
|
|
(forAllCrossSystems (crossSystem:
|
|
|
|
lib.genAttrs [ "x86_64-linux" ] (system: nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName}))));
|
2024-06-01 01:27:20 +03:00
|
|
|
|
2024-11-04 19:35:34 +02:00
|
|
|
buildNoGc = let
|
|
|
|
components = forAllSystems (system:
|
|
|
|
nixpkgsFor.${system}.native.nixComponents.overrideScope (self: super: {
|
|
|
|
nix-expr = super.nix-expr.override { enableGC = false; };
|
|
|
|
})
|
|
|
|
);
|
|
|
|
in forAllPackages (pkgName: forAllSystems (system: components.${system}.${pkgName}));
|
2024-06-01 01:27:20 +03:00
|
|
|
|
2024-08-14 23:04:35 +03:00
|
|
|
buildNoTests = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.nix-cli);
|
2024-06-01 01:27:20 +03:00
|
|
|
|
|
|
|
# Toggles some settings for better coverage. Windows needs these
|
|
|
|
# library combinations, and Debian build Nix with GNU readline too.
|
2024-11-04 19:35:34 +02:00
|
|
|
buildReadlineNoMarkdown = let
|
|
|
|
components = forAllSystems (system:
|
|
|
|
nixpkgsFor.${system}.native.nixComponents.overrideScope (self: super: {
|
|
|
|
nix-cmd = super.nix-cmd.override {
|
|
|
|
enableMarkdown = false;
|
|
|
|
readlineFlavor = "readline";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
);
|
|
|
|
in forAllPackages (pkgName: forAllSystems (system: components.${system}.${pkgName}));
|
2024-06-01 01:27:20 +03:00
|
|
|
|
|
|
|
# Perl bindings for various platforms.
|
2024-06-26 03:44:21 +03:00
|
|
|
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.nix-perl-bindings);
|
2024-06-01 01:27:20 +03:00
|
|
|
|
|
|
|
# Binary tarball for various platforms, containing a Nix store
|
|
|
|
# with the closure of 'nix' package, and the second half of
|
|
|
|
# the installation script.
|
|
|
|
binaryTarball = forAllSystems (system: binaryTarball nixpkgsFor.${system}.native.nix nixpkgsFor.${system}.native);
|
|
|
|
|
|
|
|
binaryTarballCross = lib.genAttrs [ "x86_64-linux" ] (system:
|
|
|
|
forAllCrossSystems (crossSystem:
|
|
|
|
binaryTarball
|
2024-06-04 16:28:27 +03:00
|
|
|
nixpkgsFor.${system}.cross.${crossSystem}.nix
|
2024-06-01 01:27:20 +03:00
|
|
|
nixpkgsFor.${system}.cross.${crossSystem}));
|
|
|
|
|
|
|
|
# The first half of the installation script. This is uploaded
|
|
|
|
# to https://nixos.org/nix/install. It downloads the binary
|
|
|
|
# tarball for the user's system and calls the second half of the
|
|
|
|
# installation script.
|
|
|
|
installerScript = installScriptFor [
|
|
|
|
# Native
|
|
|
|
self.hydraJobs.binaryTarball."x86_64-linux"
|
|
|
|
self.hydraJobs.binaryTarball."i686-linux"
|
|
|
|
self.hydraJobs.binaryTarball."aarch64-linux"
|
|
|
|
self.hydraJobs.binaryTarball."x86_64-darwin"
|
|
|
|
self.hydraJobs.binaryTarball."aarch64-darwin"
|
|
|
|
# Cross
|
|
|
|
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"."riscv64-unknown-linux-gnu"
|
|
|
|
];
|
|
|
|
installerScriptForGHA = installScriptFor [
|
|
|
|
# Native
|
|
|
|
self.hydraJobs.binaryTarball."x86_64-linux"
|
2024-07-01 21:38:43 +03:00
|
|
|
self.hydraJobs.binaryTarball."aarch64-darwin"
|
2024-06-01 01:27:20 +03:00
|
|
|
# Cross
|
|
|
|
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"."riscv64-unknown-linux-gnu"
|
|
|
|
];
|
|
|
|
|
|
|
|
# docker image with Nix inside
|
|
|
|
dockerImage = lib.genAttrs linux64BitSystems (system: self.packages.${system}.dockerImage);
|
|
|
|
|
2024-11-07 14:46:37 +02:00
|
|
|
# Line coverage analysis.
|
|
|
|
coverage = nixpkgsFor.x86_64-linux.native.nix.override {
|
|
|
|
pname = "nix-coverage";
|
|
|
|
withCoverageChecks = true;
|
|
|
|
};
|
2024-05-31 20:12:35 +03:00
|
|
|
|
2024-07-30 22:05:22 +03:00
|
|
|
# Nix's manual
|
|
|
|
manual = nixpkgsFor.x86_64-linux.native.nixComponents.nix-manual;
|
|
|
|
|
2024-06-01 01:27:20 +03:00
|
|
|
# API docs for Nix's unstable internal C++ interfaces.
|
2024-06-26 11:47:13 +03:00
|
|
|
internal-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-internal-api-docs;
|
2024-05-31 20:12:35 +03:00
|
|
|
|
2024-06-01 01:27:20 +03:00
|
|
|
# API docs for Nix's C bindings.
|
2024-06-26 11:47:13 +03:00
|
|
|
external-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-external-api-docs;
|
2024-05-31 20:12:35 +03:00
|
|
|
|
2024-06-01 01:27:20 +03:00
|
|
|
# System tests.
|
2024-06-03 18:00:48 +03:00
|
|
|
tests = import ../tests/nixos { inherit lib nixpkgs nixpkgsFor self; } // {
|
2024-06-01 01:27:20 +03:00
|
|
|
|
|
|
|
# Make sure that nix-env still produces the exact same result
|
|
|
|
# on a particular version of Nixpkgs.
|
|
|
|
evalNixpkgs =
|
|
|
|
let
|
|
|
|
inherit (nixpkgsFor.x86_64-linux.native) runCommand nix;
|
|
|
|
in
|
|
|
|
runCommand "eval-nixos" { buildInputs = [ nix ]; }
|
|
|
|
''
|
|
|
|
type -p nix-env
|
|
|
|
# Note: we're filtering out nixos-install-tools because https://github.com/NixOS/nixpkgs/pull/153594#issuecomment-1020530593.
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
time nix-env --store dummy:// -f ${nixpkgs-regression} -qaP --drv-path | sort | grep -v nixos-install-tools > packages
|
|
|
|
[[ $(sha1sum < packages | cut -c1-40) = e01b031fc9785a572a38be6bc473957e3b6faad7 ]]
|
|
|
|
)
|
|
|
|
mkdir $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
nixpkgsLibTests =
|
|
|
|
forAllSystems (system:
|
2024-06-03 17:15:49 +03:00
|
|
|
import (nixpkgs + "/lib/tests/test-with-nix.nix")
|
2024-06-01 01:27:20 +03:00
|
|
|
{
|
2024-06-03 17:15:49 +03:00
|
|
|
lib = nixpkgsFor.${system}.native.lib;
|
2024-11-07 14:46:37 +02:00
|
|
|
nix = self.packages.${system}.nix;
|
2024-06-01 01:27:20 +03:00
|
|
|
pkgs = nixpkgsFor.${system}.native;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
2024-05-31 20:12:35 +03:00
|
|
|
|
2024-06-01 01:27:20 +03:00
|
|
|
metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" {
|
|
|
|
pkgs = nixpkgsFor.x86_64-linux.native;
|
|
|
|
nixpkgs = nixpkgs-regression;
|
|
|
|
};
|
2024-05-31 20:12:35 +03:00
|
|
|
|
2024-06-01 01:27:20 +03:00
|
|
|
installTests = forAllSystems (system:
|
|
|
|
let pkgs = nixpkgsFor.${system}.native; in
|
|
|
|
pkgs.runCommand "install-tests"
|
|
|
|
{
|
2024-11-04 20:07:26 +02:00
|
|
|
againstSelf = testNixVersions pkgs pkgs.nix;
|
2024-06-03 17:35:45 +03:00
|
|
|
againstCurrentLatest =
|
2024-06-01 01:27:20 +03:00
|
|
|
# FIXME: temporarily disable this on macOS because of #3605.
|
|
|
|
if system == "x86_64-linux"
|
2024-11-04 19:15:41 +02:00
|
|
|
then testNixVersions pkgs pkgs.nixVersions.latest
|
2024-06-01 01:27:20 +03:00
|
|
|
else null;
|
|
|
|
# Disabled because the latest stable version doesn't handle
|
|
|
|
# `NIX_DAEMON_SOCKET_PATH` which is required for the tests to work
|
2024-11-04 19:15:41 +02:00
|
|
|
# againstLatestStable = testNixVersions pkgs pkgs.nixStable;
|
2024-06-01 01:27:20 +03:00
|
|
|
} "touch $out");
|
|
|
|
|
|
|
|
installerTests = import ../tests/installer {
|
|
|
|
binaryTarballs = self.hydraJobs.binaryTarball;
|
|
|
|
inherit nixpkgsFor;
|
2024-05-31 20:12:35 +03:00
|
|
|
};
|
|
|
|
}
|