From 32be3c655c294498adac585d4c63ce3ab2191b4e Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Thu, 10 Apr 2025 14:41:30 +0200 Subject: [PATCH] lixPackageSets: support splicing --- pkgs/tools/package-management/lix/default.nix | 149 ++++++++++-------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 905adc377950..43d873e26129 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -1,13 +1,14 @@ { lib, stdenv, + makeScopeWithSplicing', + generateSplicesForMkScope, aws-sdk-cpp, boehmgc, callPackage, fetchgit, fetchFromGitHub, rustPlatform, - newScope, editline, ncurses, clangStdenv, @@ -22,6 +23,7 @@ let makeLixScope = { + attrName, lix-args, nix-eval-jobs-args, }: @@ -29,83 +31,90 @@ let # GCC 13.2 is known to miscompile Lix coroutines (introduced in 2.92). lixStdenv = if lib.versionAtLeast lix-args.version "2.92" then clangStdenv else stdenv; in - lib.makeScope newScope ( - self: - lib.recurseIntoAttrs { - inherit - storeDir - stateDir - confDir - ; + makeScopeWithSplicing' { + otherSplices = generateSplicesForMkScope [ + "lixPackageSets" + attrName + ]; + f = + self: + lib.recurseIntoAttrs { + inherit + storeDir + stateDir + confDir + ; - 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 + 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 = + (aws-sdk-cpp.override { + apis = [ + "s3" + "transfer" ]; - }) - else - boehmgc-nix_2_3; + 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 = [ ]; - }; + editline = editline.override { + inherit ncurses; + enableTermcap = true; + }; - editline = editline.override { - inherit ncurses; - enableTermcap = true; + # 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) { + stdenv = lixStdenv; + }; + + nix-direnv = nix-direnv.override { + nix = self.lix; + }; + + nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs-args) { + stdenv = lixStdenv; + }; + + nix-fast-build = nix-fast-build.override { + inherit (self) nix-eval-jobs; + }; + + colmena = colmena.override { + nix = self.lix; + inherit (self) nix-eval-jobs; + }; }; - - # 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) { - stdenv = lixStdenv; - }; - - nix-direnv = nix-direnv.override { - nix = self.lix; - }; - - nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs-args) { - stdenv = lixStdenv; - }; - - nix-fast-build = nix-fast-build.override { - inherit (self) nix-eval-jobs; - }; - - colmena = colmena.override { - nix = self.lix; - inherit (self) nix-eval-jobs; - }; - } - ); + }; in lib.makeExtensible (self: { inherit makeLixScope; lix_2_90 = self.makeLixScope { + attrName = "lix_2_90"; + lix-args = rec { version = "2.90.0"; @@ -136,6 +145,8 @@ lib.makeExtensible (self: { }; lix_2_91 = self.makeLixScope { + attrName = "lix_2_91"; + lix-args = rec { version = "2.91.1"; @@ -166,6 +177,8 @@ lib.makeExtensible (self: { }; lix_2_92 = self.makeLixScope { + attrName = "lix_2_92"; + lix-args = rec { version = "2.92.0";