Unverified Commit f7a715c1 authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

nixVersions.nix_2_26: fix cross (#392832)

parents 187fb635 ac543ea0
Loading
Loading
Loading
Loading
+245 −186
Original line number Diff line number Diff line
{ lib
, config
, stdenv
, aws-sdk-cpp
, boehmgc
, libgit2
, callPackage
, fetchFromGitHub
, fetchpatch2
, runCommand
, Security
, pkgs
, pkgsi686Linux
, pkgsStatic
, nixosTests

, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
, confDir ? "/etc"
{
  lib,
  config,
  stdenv,
  aws-sdk-cpp,
  boehmgc,
  callPackage,
  fetchFromGitHub,
  fetchpatch2,
  runCommand,
  Security,
  pkgs,
  pkgsi686Linux,
  pkgsStatic,
  nixosTests,

  storeDir ? "/nix/store",
  stateDir ? "/nix/var",
  confDir ? "/etc",
}:
let
  boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
@@ -29,10 +29,15 @@ let
  });

  # old nix fails to build with newer aws-sdk-cpp and the patch doesn't apply
  aws-sdk-cpp-old-nix = (aws-sdk-cpp.override {
    apis = [ "s3" "transfer" ];
  aws-sdk-cpp-old-nix =
    (aws-sdk-cpp.override {
      apis = [
        "s3"
        "transfer"
      ];
      customMemoryManagement = false;
  }).overrideAttrs (args: rec {
    }).overrideAttrs
      (args: rec {
        # intentionally overriding postPatch
        version = "1.9.294";

@@ -42,7 +47,8 @@ let
          rev = version;
          hash = "sha256-Z1eRKW+8nVD53GkNyYlZjCcT74MqFqqRMeMc33eIQ9g=";
        };
    postPatch = ''
        postPatch =
          ''
            # Avoid blanket -Werror to evade build failures on less
            # tested compilers.
            substituteInPlace cmake/compiler_settings.cmake \
@@ -69,7 +75,8 @@ let
            rm aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp
            # TestRandomURLMultiThreaded fails
            rm aws-cpp-sdk-core-tests/http/HttpClientTest.cpp
    '' + lib.optionalString aws-sdk-cpp.stdenv.hostPlatform.isi686 ''
          ''
          + lib.optionalString aws-sdk-cpp.stdenv.hostPlatform.isi686 ''
            # EPSILON is exceeded
            rm aws-cpp-sdk-core-tests/aws/client/AdaptiveRetryStrategyTest.cpp
          '';
@@ -80,21 +87,31 @@ let
        requiredSystemFeatures = [ ];
      });

  aws-sdk-cpp-nix = (aws-sdk-cpp.override {
    apis = [ "s3" "transfer" ];
  aws-sdk-cpp-nix =
    (aws-sdk-cpp.override {
      apis = [
        "s3"
        "transfer"
      ];
      customMemoryManagement = false;
  }).overrideAttrs {
    }).overrideAttrs
      {
        # only a stripped down version is build which takes a lot less resources to build
        requiredSystemFeatures = [ ];
      };

  common = args:
    callPackage
      (import ./common.nix ({ inherit lib fetchFromGitHub; } // args))
      {
        inherit Security storeDir stateDir confDir;
  common =
    args:
    callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) {
      inherit
        Security
        storeDir
        stateDir
        confDir
        ;
      boehmgc = boehmgc-nix;
        aws-sdk-cpp = if lib.versionAtLeast args.version "2.12pre" then aws-sdk-cpp-nix else aws-sdk-cpp-old-nix;
      aws-sdk-cpp =
        if lib.versionAtLeast args.version "2.12pre" then aws-sdk-cpp-nix else aws-sdk-cpp-old-nix;
    };

  # https://github.com/NixOS/nix/pull/7585
@@ -106,20 +123,31 @@ let

  # Intentionally does not support overrideAttrs etc
  # Use only for tests that are about the package relation to `pkgs` and/or NixOS.
  addTestsShallowly = tests: pkg: pkg // {
  addTestsShallowly =
    tests: pkg:
    pkg
    // {
      tests = pkg.tests // tests;
      # In case someone reads the wrong attribute
      passthru.tests = pkg.tests // tests;
    };

  addFallbackPathsCheck = pkg: addTestsShallowly
    { nix-fallback-paths =
        runCommand "test-nix-fallback-paths-version-equals-nix-stable" {
          paths = lib.concatStringsSep "\n" (builtins.attrValues (import ../../../../nixos/modules/installer/tools/nix-fallback-paths.nix));
        } ''
  addFallbackPathsCheck =
    pkg:
    addTestsShallowly {
      nix-fallback-paths =
        runCommand "test-nix-fallback-paths-version-equals-nix-stable"
          {
            paths = lib.concatStringsSep "\n" (
              builtins.attrValues (import ../../../../nixos/modules/installer/tools/nix-fallback-paths.nix)
            );
          }
          ''
            # NOTE: name may contain cross compilation details between the pname
            #       and version this is permitted thanks to ([^-]*-)*
          if [[ "" != $(grep -vE 'nix-([^-]*-)*${lib.strings.replaceStrings ["."] ["\\."] pkg.version}$' <<< "$paths") ]]; then
            if [[ "" != $(grep -vE 'nix-([^-]*-)*${
              lib.strings.replaceStrings [ "." ] [ "\\." ] pkg.version
            }$' <<< "$paths") ]]; then
              echo "nix-fallback-paths not up to date with nixVersions.stable (nix-${pkg.version})"
              echo "The following paths are not up to date:"
              grep -v 'nix-${pkg.version}$' <<< "$paths"
@@ -134,34 +162,51 @@ let
              touch $out
            fi
          '';
    }
    pkg;
    } pkg;

  # (meson based packaging)
  # Add passthru tests to the package, and re-expose package set overriding
  # functions. This will not incorporate the tests into the package set.
  # TODO (roberth): add package-set level overriding to the "everything" package.
  addTests = selfAttributeName: pkg:
  addTests =
    selfAttributeName: pkg:
    let
      tests =
        pkg.tests or { }
        // import ./tests.nix {
          inherit runCommand lib stdenv pkgs pkgsi686Linux pkgsStatic nixosTests;
          inherit
            runCommand
            lib
            stdenv
            pkgs
            pkgsi686Linux
            pkgsStatic
            nixosTests
            ;
          inherit (pkg) version src;
          nix = pkg;
          self_attribute_name = selfAttributeName;
        };
    in
    # preserve old pkg, including overrideSource, etc
    pkg // {
    pkg
    // {
      tests = pkg.tests or { } // tests;
      passthru = pkg.passthru or { } // {
        tests = lib.warn "nix.passthru.tests is deprecated. Use nix.tests instead." pkg.passthru.tests or {} // tests;
        tests =
          lib.warn "nix.passthru.tests is deprecated. Use nix.tests instead." pkg.passthru.tests or { }
          // tests;
      };
    };

in lib.makeExtensible (self: ({
  nix_2_3 = ((common {
in
lib.makeExtensible (
  self:
  (
    {
      nix_2_3 =
        (
          (common {
            version = "2.3.18";
            hash = "sha256-jBz2Ub65eFYG+aWgSI3AJYvLSghio77fWQiIW1svA9U=";
            patches = [
@@ -169,7 +214,10 @@ in lib.makeExtensible (self: ({
            ];
            self_attribute_name = "nix_2_3";
            maintainers = with lib.maintainers; [ flokli ];
  }).override { boehmgc = boehmgc-nix_2_3; }).overrideAttrs {
          }).override
          { boehmgc = boehmgc-nix_2_3; }
        ).overrideAttrs
          {
            # https://github.com/NixOS/nix/issues/10222
            # spurious test/add.sh failures
            enableParallelChecking = false;
@@ -187,7 +235,13 @@ in lib.makeExtensible (self: ({
        self_attribute_name = "nix_2_25";
      };

  nix_2_26 = addTests "nix_2_26" (callPackage ./vendor/2_26/componentized.nix { inherit (self.nix_2_24.meta) maintainers; });
      components.nix_2_26 = (
        callPackage ./vendor/2_26/componentized.nix {
          inherit (self.nix_2_24.meta) maintainers;
          selfAttributeName = "nix_2_26";
        }
      );
      nix_2_26 = addTests "nix_2_26" self.components.nix_2_26.nix-everything;

      git = common rec {
        version = "2.25.0";
@@ -222,15 +276,20 @@ in lib.makeExtensible (self: ({

      # Read ./README.md before bumping a major release
      stable = addFallbackPathsCheck self.nix_2_24;
} // lib.optionalAttrs config.allowAliases (
  lib.listToAttrs (map (
    }
    // lib.optionalAttrs config.allowAliases (
      lib.listToAttrs (
        map (
          minor:
          let
            attr = "nix_2_${toString minor}";
          in
          lib.nameValuePair attr (throw "${attr} has been removed")
  ) (lib.range 4 23))
        ) (lib.range 4 23)
      )
      // {
        unstable = throw "nixVersions.unstable has been removed. For bleeding edge (Nix master, roughly weekly updated) use nixVersions.git, otherwise use nixVersions.latest.";
      }
)))
    )
  )
)
+14 −3
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
  pkgs,
  stdenv,
  maintainers,
  selfAttributeName,
  ...
}:
let
@@ -24,7 +25,11 @@ let
        inherit (nixDependencies) newScope;
      }
      {
        otherSplices = generateSplicesForMkScope "nixComponents";
        otherSplices = generateSplicesForMkScope [
          "nixVersions"
          "components"
          selfAttributeName
        ];
        f = import ./packaging/components.nix {
          inherit
            lib
@@ -45,11 +50,17 @@ let
        inherit newScope; # layered directly on pkgs, unlike nixComponents above
      }
      {
        otherSplices = generateSplicesForMkScope "nixDependencies";
        # Technically this should point to the nixDependencies set only, but
        # this is ok as long as the scopes don't intersect.
        otherSplices = generateSplicesForMkScope [
          "nixVersions"
          "components"
          selfAttributeName
        ];
        f = import ./dependencies.nix {
          inherit pkgs;
          inherit stdenv;
        };
      };
in
(nixComponents.overrideSource src).nix-everything
nixComponents.overrideSource src