diff --git a/flake.nix b/flake.nix index 84691fa87..04fc37854 100644 --- a/flake.nix +++ b/flake.nix @@ -44,8 +44,17 @@ systems = linuxSystems ++ darwinSystems; crossSystems = [ - "armv6l-linux" "armv7l-linux" - "x86_64-freebsd13" "x86_64-netbsd" + "armv6l-unknown-linux-gnueabihf" + "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 = [ @@ -78,8 +87,8 @@ inherit system; }; crossSystem = if crossSystem == null then null else { - system = crossSystem; - } // lib.optionalAttrs (crossSystem == "x86_64-freebsd13") { + config = crossSystem; + } // lib.optionalAttrs (crossSystem == "x86_64-unknown-freebsd13") { useLLVM = true; }; overlays = [ @@ -91,20 +100,12 @@ in { inherit stdenvs native; 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 { - systemTarballPairs = map - (system: { - inherit system; - tarball = - if builtins.elem system crossSystems - then self.hydraJobs.binaryTarballCross.x86_64-linux.${system} - else self.hydraJobs.binaryTarball.${system}; - }) - systems; + inherit tarballs; }; testNixVersions = pkgs: client: daemon: @@ -264,19 +265,23 @@ # tarball for the user's system and calls the second half of the # installation script. installerScript = installScriptFor [ - "aarch64-linux" - "armv6l-linux" - "armv7l-linux" - "i686-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" + # 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" ]; installerScriptForGHA = installScriptFor [ - "armv6l-linux" - "armv7l-linux" - "x86_64-linux" - "x86_64-darwin" + # Native + self.hydraJobs.binaryTarball."x86_64-linux" + self.hydraJobs.binaryTarball."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 @@ -416,7 +421,7 @@ in (makeShells "native" nixpkgsFor.${system}.native) // (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; } diff --git a/maintainers/upload-release.pl b/maintainers/upload-release.pl index ebc536f12..4e2c379f0 100755 --- a/maintainers/upload-release.pl +++ b/maintainers/upload-release.pl @@ -154,8 +154,8 @@ downloadFile("binaryTarball.x86_64-linux", "1"); downloadFile("binaryTarball.aarch64-linux", "1"); downloadFile("binaryTarball.x86_64-darwin", "1"); downloadFile("binaryTarball.aarch64-darwin", "1"); -downloadFile("binaryTarballCross.x86_64-linux.armv6l-linux", "1"); -downloadFile("binaryTarballCross.x86_64-linux.armv7l-linux", "1"); +downloadFile("binaryTarballCross.x86_64-linux.armv6l-unknown-linux-gnueabihf", "1"); +downloadFile("binaryTarballCross.x86_64-linux.armv7l-unknown-linux-gnueabihf", "1"); downloadFile("installerScript", "1"); # Upload docker images to dockerhub. diff --git a/package.nix b/package.nix index 96b9111f8..7c1ba3130 100644 --- a/package.nix +++ b/package.nix @@ -214,14 +214,15 @@ in { brotli bzip2 curl - editline libarchive libgit2 libsodium - lowdown openssl sqlite xz + ] ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ + editline + lowdown ] ++ lib.optional stdenv.isLinux libseccomp ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid # There have been issues building these dependencies @@ -353,7 +354,7 @@ in { hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; meta = { - platforms = lib.platforms.unix; + platforms = lib.platforms.unix ++ lib.platforms.windows; mainProgram = "nix"; broken = !(lib.all (a: a) [ # We cannot run or install unit tests if we don't build them or diff --git a/scripts/installer.nix b/scripts/installer.nix index 35d2d7fe6..cc7759c2c 100644 --- a/scripts/installer.nix +++ b/scripts/installer.nix @@ -1,7 +1,7 @@ { lib , runCommand , nix -, systemTarballPairs +, tarballs }: runCommand "installer-script" { @@ -22,13 +22,14 @@ runCommand "installer-script" { substitute ${./install.in} $out/install \ ${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 '@tarballPath_${system}@' $(tarballPath ${tarball}/*.tar.xz) \ '' ) - systemTarballPairs + tarballs } --replace '@nixVersion@' ${nix.version} echo "file installer $out/install" >> $out/nix-support/hydra-build-products diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 800df7fa0..7f35e74af 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -547,8 +547,8 @@ std::map> Store::queryPartialDerivationOut return outputs; } -OutputPathMap Store::queryDerivationOutputMap(const StorePath & path) { - auto resp = queryPartialDerivationOutputMap(path); +OutputPathMap Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore) { + auto resp = queryPartialDerivationOutputMap(path, evalStore); OutputPathMap result; for (auto & [outName, optOutPath] : resp) { if (!optOutPath) diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index ada6699d5..13e5a1446 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -369,7 +369,7 @@ public: * Query the mapping outputName=>outputPath for the given derivation. * 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