Merge remote-tracking branch 'upstream/master' into package-nix

This commit is contained in:
John Ericson 2023-12-11 15:26:12 -05:00
commit ff992f8b46
6 changed files with 46 additions and 39 deletions

View file

@ -44,8 +44,17 @@
systems = linuxSystems ++ darwinSystems; systems = linuxSystems ++ darwinSystems;
crossSystems = [ crossSystems = [
"armv6l-linux" "armv7l-linux" "armv6l-unknown-linux-gnueabihf"
"x86_64-freebsd13" "x86_64-netbsd" "armv7l-unknown-linux-gnueabihf"
"x86_64-unknown-freebsd13"
"x86_64-unknown-netbsd"
];
# Nix doesn't yet build on this platform, so we put it in a
# separate list. We just use this for `devShells` and
# `nixpkgsFor`, which this depends on.
shellCrossSystems = crossSystems ++ [
"x86_64-w64-mingw32"
]; ];
stdenvs = [ stdenvs = [
@ -78,8 +87,8 @@
inherit system; inherit system;
}; };
crossSystem = if crossSystem == null then null else { crossSystem = if crossSystem == null then null else {
system = crossSystem; config = crossSystem;
} // lib.optionalAttrs (crossSystem == "x86_64-freebsd13") { } // lib.optionalAttrs (crossSystem == "x86_64-unknown-freebsd13") {
useLLVM = true; useLLVM = true;
}; };
overlays = [ overlays = [
@ -91,20 +100,12 @@
in { in {
inherit stdenvs native; inherit stdenvs native;
static = native.pkgsStatic; static = native.pkgsStatic;
cross = forAllCrossSystems (crossSystem: make-pkgs crossSystem "stdenv"); cross = lib.genAttrs shellCrossSystems (crossSystem: make-pkgs crossSystem "stdenv");
}); });
installScriptFor = systems: installScriptFor = tarballs:
nixpkgsFor.x86_64-linux.native.callPackage ./scripts/installer.nix { nixpkgsFor.x86_64-linux.native.callPackage ./scripts/installer.nix {
systemTarballPairs = map inherit tarballs;
(system: {
inherit system;
tarball =
if builtins.elem system crossSystems
then self.hydraJobs.binaryTarballCross.x86_64-linux.${system}
else self.hydraJobs.binaryTarball.${system};
})
systems;
}; };
testNixVersions = pkgs: client: daemon: testNixVersions = pkgs: client: daemon:
@ -264,19 +265,23 @@
# 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 [
"aarch64-linux" # Native
"armv6l-linux" self.hydraJobs.binaryTarball."x86_64-linux"
"armv7l-linux" self.hydraJobs.binaryTarball."i686-linux"
"i686-linux" self.hydraJobs.binaryTarball."aarch64-linux"
"x86_64-linux" self.hydraJobs.binaryTarball."x86_64-darwin"
"aarch64-darwin" self.hydraJobs.binaryTarball."aarch64-darwin"
"x86_64-darwin" # Cross
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
]; ];
installerScriptForGHA = installScriptFor [ installerScriptForGHA = installScriptFor [
"armv6l-linux" # Native
"armv7l-linux" self.hydraJobs.binaryTarball."x86_64-linux"
"x86_64-linux" self.hydraJobs.binaryTarball."x86_64-darwin"
"x86_64-darwin" # Cross
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
]; ];
# docker image with Nix inside # docker image with Nix inside
@ -416,7 +421,7 @@
in in
(makeShells "native" nixpkgsFor.${system}.native) // (makeShells "native" nixpkgsFor.${system}.native) //
(makeShells "static" nixpkgsFor.${system}.static) // (makeShells "static" nixpkgsFor.${system}.static) //
(forAllCrossSystems (crossSystem: let pkgs = nixpkgsFor.${system}.cross.${crossSystem}; in makeShell pkgs pkgs.stdenv)) // (lib.genAttrs shellCrossSystems (crossSystem: let pkgs = nixpkgsFor.${system}.cross.${crossSystem}; in makeShell pkgs pkgs.stdenv)) //
{ {
default = self.devShells.${system}.native-stdenvPackages; default = self.devShells.${system}.native-stdenvPackages;
} }

View file

@ -154,8 +154,8 @@ downloadFile("binaryTarball.x86_64-linux", "1");
downloadFile("binaryTarball.aarch64-linux", "1"); downloadFile("binaryTarball.aarch64-linux", "1");
downloadFile("binaryTarball.x86_64-darwin", "1"); downloadFile("binaryTarball.x86_64-darwin", "1");
downloadFile("binaryTarball.aarch64-darwin", "1"); downloadFile("binaryTarball.aarch64-darwin", "1");
downloadFile("binaryTarballCross.x86_64-linux.armv6l-linux", "1"); downloadFile("binaryTarballCross.x86_64-linux.armv6l-unknown-linux-gnueabihf", "1");
downloadFile("binaryTarballCross.x86_64-linux.armv7l-linux", "1"); downloadFile("binaryTarballCross.x86_64-linux.armv7l-unknown-linux-gnueabihf", "1");
downloadFile("installerScript", "1"); downloadFile("installerScript", "1");
# Upload docker images to dockerhub. # Upload docker images to dockerhub.

View file

@ -214,14 +214,15 @@ in {
brotli brotli
bzip2 bzip2
curl curl
editline
libarchive libarchive
libgit2 libgit2
libsodium libsodium
lowdown
openssl openssl
sqlite sqlite
xz xz
] ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
editline
lowdown
] ++ lib.optional stdenv.isLinux libseccomp ] ++ lib.optional stdenv.isLinux libseccomp
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
# There have been issues building these dependencies # There have been issues building these dependencies
@ -353,7 +354,7 @@ in {
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = { meta = {
platforms = lib.platforms.unix; platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = "nix"; mainProgram = "nix";
broken = !(lib.all (a: a) [ broken = !(lib.all (a: a) [
# We cannot run or install unit tests if we don't build them or # We cannot run or install unit tests if we don't build them or

View file

@ -1,7 +1,7 @@
{ lib { lib
, runCommand , runCommand
, nix , nix
, systemTarballPairs , tarballs
}: }:
runCommand "installer-script" { runCommand "installer-script" {
@ -22,13 +22,14 @@ runCommand "installer-script" {
substitute ${./install.in} $out/install \ substitute ${./install.in} $out/install \
${lib.concatMapStrings ${lib.concatMapStrings
({ system, tarball }: (tarball: let
'' \ inherit (tarball.stdenv.hostPlatform) system;
in '' \
--replace '@tarballHash_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${tarball}/*.tar.xz) \ --replace '@tarballHash_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${tarball}/*.tar.xz) \
--replace '@tarballPath_${system}@' $(tarballPath ${tarball}/*.tar.xz) \ --replace '@tarballPath_${system}@' $(tarballPath ${tarball}/*.tar.xz) \
'' ''
) )
systemTarballPairs tarballs
} --replace '@nixVersion@' ${nix.version} } --replace '@nixVersion@' ${nix.version}
echo "file installer $out/install" >> $out/nix-support/hydra-build-products echo "file installer $out/install" >> $out/nix-support/hydra-build-products

View file

@ -547,8 +547,8 @@ std::map<std::string, std::optional<StorePath>> Store::queryPartialDerivationOut
return outputs; return outputs;
} }
OutputPathMap Store::queryDerivationOutputMap(const StorePath & path) { OutputPathMap Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore) {
auto resp = queryPartialDerivationOutputMap(path); auto resp = queryPartialDerivationOutputMap(path, evalStore);
OutputPathMap result; OutputPathMap result;
for (auto & [outName, optOutPath] : resp) { for (auto & [outName, optOutPath] : resp) {
if (!optOutPath) if (!optOutPath)

View file

@ -369,7 +369,7 @@ public:
* Query the mapping outputName=>outputPath for the given derivation. * Query the mapping outputName=>outputPath for the given derivation.
* Assume every output has a mapping and throw an exception otherwise. * Assume every output has a mapping and throw an exception otherwise.
*/ */
OutputPathMap queryDerivationOutputMap(const StorePath & path); OutputPathMap queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
/** /**
* Query the full store path given the hash part of a valid store * Query the full store path given the hash part of a valid store