diff --git a/pkgs/tools/package-management/lix/common.nix b/pkgs/tools/package-management/lix/common-lix.nix similarity index 99% rename from pkgs/tools/package-management/lix/common.nix rename to pkgs/tools/package-management/lix/common-lix.nix index 7fb40b11776c..2e23c9c9e049 100644 --- a/pkgs/tools/package-management/lix/common.nix +++ b/pkgs/tools/package-management/lix/common-lix.nix @@ -1,6 +1,5 @@ { 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 diff --git a/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix b/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix new file mode 100644 index 000000000000..f80353d1754f --- /dev/null +++ b/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix @@ -0,0 +1,56 @@ +{ + 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; + }; +} diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 88cd8bbc70a9..5c351b2542a2 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -3,58 +3,80 @@ 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: { - patches = (drv.patches or [ ]) ++ [ - # Part of the GC solution in https://github.com/NixOS/nix/pull/4944 - ../nix/patches/boehmgc-coroutine-sp-fallback.patch - ]; - }); + 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.override { - apis = [ - "s3" - "transfer" - ]; - customMemoryManagement = false; - }).overrideAttrs - { - # only a stripped down version is build which takes a lot less resources to build - requiredSystemFeatures = [ ]; - }; + aws-sdk-cpp = + (aws-sdk-cpp.override { + apis = [ + "s3" + "transfer" + ]; + customMemoryManagement = false; + }).overrideAttrs + { + # only a stripped down version is build which takes a lot less resources to build + 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="; }; - } - ); + }; - lix_2_91 = ( - common rec { + 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 = 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"; + }; }) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 18b35816844d..0e2b4c5e90d6 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2e4f41e19931..7c4ab4ea42c0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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;