Unverified Commit 1eba6b89 authored by jade's avatar jade Committed by GitHub
Browse files

lix: package `nix-eval-jobs` (#391402)

parents ff65426c 89940769
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  suffix ? "",
  version,
  src,
@@ -8,6 +7,7 @@
  patches ? [ ],
  maintainers ? lib.teams.lix.members,
}@args:

{
  stdenv,
  meson,
@@ -67,6 +67,7 @@
  stateDir,
  storeDir,
}:

let
  isLegacyParser = lib.versionOlder version "2.91";
in
+56 −0
Original line number Diff line number Diff line
{
  lib,
  suffix ? "",
  version,
  src,
  patches ? [ ],
  maintainers ? lib.teams.lix.members,
}@args:

{
  stdenv,
  lib,
  lix,
  boost,
  nlohmann_json,
  meson,
  pkg-config,
  ninja,
  cmake,
  clang-tools,
}:

stdenv.mkDerivation {
  pname = "nix-eval-jobs";
  version = "${version}${suffix}";
  inherit src patches;
  buildInputs = [
    nlohmann_json
    lix
    boost
  ];
  nativeBuildInputs = [
    meson
    pkg-config
    ninja
    # nlohmann_json can be only discovered via cmake files
    cmake
  ] ++ (lib.optional stdenv.cc.isClang [ clang-tools ]);

  # point 'nix edit' and ofborg at the file that defines the attribute,
  # not this common file.
  pos = builtins.unsafeGetAttrPos "version" args;
  meta = {
    description = "Hydra's builtin `hydra-eval-jobs` as a standalone tool";
    mainProgram = "nix-eval-jobs";
    homepage =
      # Starting with 2.93, `nix-eval-jobs` lives in the `lix` repository.
      if lib.versionAtLeast version "2.93" then
        "https://git.lix.systems/lix-project/lix/src/branch/main/subprojects/nix-eval-jobs"
      else
        "https://git.lix.systems/lix-project/nix-eval-jobs";
    license = lib.licenses.gpl3;
    inherit maintainers;
    platforms = lib.platforms.unix;
  };
}
+105 −45
Original line number Diff line number Diff line
@@ -3,25 +3,49 @@
  aws-sdk-cpp,
  boehmgc,
  callPackage,
  fetchgit,
  fetchFromGitHub,
  rustPlatform,
  Security,
  newScope,

  storeDir ? "/nix/store",
  stateDir ? "/nix/var",
  confDir ? "/etc",
}:
let
  boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
  makeLixScope =
    {
      lix-args,
      nix-eval-jobs-args,
    }:
    lib.makeScope newScope (
      self:
      lib.recurseIntoAttrs {
        inherit
          Security
          storeDir
          stateDir
          confDir
          ;

  boehmgc-nix = boehmgc-nix_2_3.overrideAttrs (drv: {
        boehmgc =
          # TODO: Why is this called `boehmgc-nix_2_3`?
          let
            boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
          in
          # Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either.
          if lib.versionOlder lix-args.version "2.91" then
            boehmgc-nix_2_3.overrideAttrs (drv: {
              patches = (drv.patches or [ ]) ++ [
                # Part of the GC solution in https://github.com/NixOS/nix/pull/4944
                ../nix/patches/boehmgc-coroutine-sp-fallback.patch
              ];
  });
            })
          else
            boehmgc-nix_2_3;

  aws-sdk-cpp-nix =
        aws-sdk-cpp =
          (aws-sdk-cpp.override {
            apis = [
              "s3"
@@ -34,27 +58,25 @@ let
              requiredSystemFeatures = [ ];
            };

  # Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either.
  needsBoehmgcPatches = version: lib.versionOlder version "2.91";
        # NOTE: The `common-*.nix` helpers contain a top-level function which
        # takes the Lix source to build and version information. We use the
        # outer `callPackage` for that.
        #
        # That *returns* another function which takes the actual build
        # dependencies, and that uses the new scope's `self.callPackage` so
        # that `nix-eval-jobs` can be built against the correct `lix` version.
        lix = self.callPackage (callPackage ./common-lix.nix lix-args) { };

        nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs-args) { };
      }
    );

  common =
    args:
    callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) {
      inherit
        Security
        storeDir
        stateDir
        confDir
        ;
      boehmgc = if needsBoehmgcPatches args.version then boehmgc-nix else boehmgc-nix_2_3;
      aws-sdk-cpp = aws-sdk-cpp-nix;
    };
in
lib.makeExtensible (self: {
  buildLix = common;
  inherit makeLixScope;

  lix_2_90 = (
    common rec {
  lix_2_90 = self.makeLixScope {
    lix-args = rec {
      version = "2.90.0";

      src = fetchFromGitHub {
@@ -71,11 +93,21 @@ lib.makeExtensible (self: {
        sourceRoot = "${src.name or src}/lix-doc";
        hash = "sha256-VPcrf78gfLlkTRrcbLkPgLOk0o6lsOJBm6HYLvavpNU=";
      };
    }
  );
    };

    nix-eval-jobs-args = {
      version = "2.90.0";
      src = fetchgit {
        url = "https://git.lix.systems/lix-project/nix-eval-jobs.git";
        # https://git.lix.systems/lix-project/nix-eval-jobs/commits/branch/release-2.90
        rev = "9c23772cf25e0d891bef70b7bcb7df36239672a5";
        hash = "sha256-oT273pDmYzzI7ACAFUOcsxtT6y34V5KF7VBSqTza7j8=";
      };
    };
  };

  lix_2_91 = (
    common rec {
  lix_2_91 = self.makeLixScope {
    lix-args = rec {
      version = "2.91.1";

      src = fetchFromGitHub {
@@ -92,9 +124,37 @@ lib.makeExtensible (self: {
        sourceRoot = "${src.name or src}/lix-doc";
        hash = "sha256-U820gvcbQIBaFr2OWPidfFIDXycDFGgXX1NpWDDqENs=";
      };
    }
  );
    };

    nix-eval-jobs-args = {
      version = "2.91.0";
      src = fetchgit {
        url = "https://git.lix.systems/lix-project/nix-eval-jobs.git";
        # https://git.lix.systems/lix-project/nix-eval-jobs/commits/branch/release-2.91
        rev = "1f98b0c016a6285f29ad278fa5cd82b8f470d66a";
        hash = "sha256-ZJKOC/iLuO8qjPi9/ql69Vgh3NIu0tU6CSI0vbiCrKA=";
      };
    };
  };

  latest = self.lix_2_91;
  stable = self.lix_2_91;

  # Previously, `nix-eval-jobs` was not packaged here, so we export an
  # attribute with the previously-expected structure for compatibility. This
  # is also available (for now) as `pkgs.lixVersions`.
  renamedDeprecatedLixVersions =
    let
      mkAlias =
        version:
        lib.warnOnInstantiate "'lixVersions.${version}' has been renamed to 'lixPackageSets.${version}.lix'"
          self.${version}.lix;
    in
    lib.dontRecurseIntoAttrs {
      lix_2_90 = mkAlias "lix_2_90";
      lix_2_91 = mkAlias "lix_2_91";
      # NOTE: Do not add new versions of Lix here.
      stable = mkAlias "stable";
      latest = mkAlias "latest";
    };
})
+2 −0
Original line number Diff line number Diff line
@@ -904,6 +904,8 @@ mapAliases {

  linuxstopmotion = stopmotion; # Added 2024-11-01

  lixVersions = lixPackageSets.renamedDeprecatedLixVersions; # Added 2025-03-20, warning in ../tools/package-management/lix/default.nix

  llvmPackages_git = (callPackages ../development/compilers/llvm { }).git;

  lld_9 = throw "lld_9 has been removed from nixpkgs"; # Added 2024-04-08
+2 −2
Original line number Diff line number Diff line
@@ -17211,13 +17211,13 @@ with pkgs;
  nixStatic = pkgsStatic.nix;
  lixVersions = recurseIntoAttrs (callPackage ../tools/package-management/lix {
  lixPackageSets = recurseIntoAttrs (callPackage ../tools/package-management/lix {
    storeDir = config.nix.storeDir or "/nix/store";
    stateDir = config.nix.stateDir or "/nix/var";
    inherit (darwin.apple_sdk.frameworks) Security;
  });
  lix = lixVersions.stable;
  lix = lixPackageSets.stable.lix;
  lixStatic = pkgsStatic.lix;