From 2ad2194aab92513ec20da288b1b92e27c28d4be6 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Thu, 10 Apr 2025 14:41:30 +0200 Subject: [PATCH 1/4] lixPackageSets: support splicing --- pkgs/tools/package-management/lix/default.nix | 155 ++++++++++-------- 1 file changed, 84 insertions(+), 71 deletions(-) diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 905adc3779502..43d873e261291 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 - ; - - 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 + 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 + ]; + }) + else + boehmgc-nix_2_3; + + aws-sdk-cpp = + (aws-sdk-cpp.override { + apis = [ + "s3" + "transfer" ]; - }) - else - boehmgc-nix_2_3; - - 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; + 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; + }; + + # 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"; From 89663951afe2316d67a21438d2c12f0d9b9327d4 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Sat, 10 May 2025 11:06:47 +0200 Subject: [PATCH 2/4] lixPackageSets.*.lix: test the correct Lix in passthru.tests Previously always the top-level lix package would be used, which is obviously not what we want. --- nixos/tests/installer.nix | 13 +++++++----- nixos/tests/nix/misc.nix | 20 ++++++++----------- .../package-management/lix/common-lix.nix | 4 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index f089e0074085b..7ee3a771184af 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -632,6 +632,7 @@ let grubUseEfi ? false, enableOCR ? false, meta ? { }, + passthru ? { }, testSpecialisationConfig ? false, testFlakeSwitch ? false, testByAttrSwitch ? false, @@ -644,7 +645,7 @@ let isEfi = bootLoader == "systemd-boot" || (bootLoader == "grub" && grubUseEfi); in makeTest { - inherit enableOCR; + inherit enableOCR passthru; name = "installer-" + name; meta = { # put global maintainers here, individuals go into makeInstallerTest fkt call @@ -1109,10 +1110,12 @@ in # The (almost) simplest partitioning scheme: a swap partition and # one big filesystem partition. - simple = makeInstallerTest "simple" simple-test-config; - lix-simple = makeInstallerTest "simple" simple-test-config // { - selectNixPackage = pkgs: pkgs.lix; - }; + simple = makeInstallerTest "simple" ( + simple-test-config + // { + passthru.override = args: makeInstallerTest "simple" simple-test-config // args; + } + ); switchToFlake = makeInstallerTest "switch-to-flake" simple-test-config-flake; diff --git a/nixos/tests/nix/misc.nix b/nixos/tests/nix/misc.nix index be23d4e450e3a..c594f4055cfc3 100644 --- a/nixos/tests/nix/misc.nix +++ b/nixos/tests/nix/misc.nix @@ -3,20 +3,16 @@ let inherit (pkgs) lib; - tests = { - default = testsForPackage { nixPackage = pkgs.nix; }; - lix = testsForPackage { nixPackage = pkgs.lix; }; - }; + tests.default = testsForPackage { nixPackage = pkgs.nix; }; - testsForPackage = - args: - lib.recurseIntoAttrs { - # If the attribute is not named 'test' - # You will break all the universe on the release-*.nix side of things. - # `discoverTests` relies on `test` existence to perform a `callTest`. - test = testMiscFeatures args; - passthru.override = args': testsForPackage (args // args'); + testsForPackage = args: { + # If the attribute is not named 'test' + # You will break all the universe on the release-*.nix side of things. + # `discoverTests` relies on `test` existence to perform a `callTest`. + test = testMiscFeatures args // { + passthru.override = args': (testsForPackage (args // args')).test; }; + }; testMiscFeatures = { nixPackage, ... }: diff --git a/pkgs/tools/package-management/lix/common-lix.nix b/pkgs/tools/package-management/lix/common-lix.nix index 4f332142526e1..1e62021c7f687 100644 --- a/pkgs/tools/package-management/lix/common-lix.nix +++ b/pkgs/tools/package-management/lix/common-lix.nix @@ -347,8 +347,8 @@ stdenv.mkDerivation (finalAttrs: { passthru = { inherit aws-sdk-cpp boehmgc; tests = { - misc = nixosTests.nix-misc.lix; - installer = nixosTests.installer.lix-simple; + misc = nixosTests.nix-misc.default.passthru.override { nixPackage = finalAttrs.finalPackage; }; + installer = nixosTests.installer.simple.override { selectNixPackage = _: finalAttrs.finalPackage; }; }; }; From cf78bf6851f096352e4510a0570d13e7178356c3 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Thu, 10 Apr 2025 18:11:59 +0200 Subject: [PATCH 3/4] lixPackageSets.lix_2_93: init at 2.93.0 --- .../package-management/lix/common-lix.nix | 17 ++++++++++- .../lix/common-nix-eval-jobs.nix | 16 ++++++---- pkgs/tools/package-management/lix/default.nix | 29 +++++++++++++++++-- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/package-management/lix/common-lix.nix b/pkgs/tools/package-management/lix/common-lix.nix index 1e62021c7f687..13f6d88828e6d 100644 --- a/pkgs/tools/package-management/lix/common-lix.nix +++ b/pkgs/tools/package-management/lix/common-lix.nix @@ -42,6 +42,7 @@ assert lib.assertMsg ( libarchive, libcpuid, libsodium, + libsystemtap, llvmPackages, lowdown, lowdown-unsandboxed, @@ -59,9 +60,11 @@ assert lib.assertMsg ( pkg-config, rapidcheck, sqlite, + systemtap-sdt, util-linuxMinimal, removeReferencesTo, xz, + yq, nixosTests, rustPlatform, # Only used for versions before 2.92. @@ -76,6 +79,10 @@ assert lib.assertMsg ( enableStrictLLVMChecks ? true, withAWS ? !enableStatic && (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin), aws-sdk-cpp, + # FIXME support Darwin once https://github.com/NixOS/nixpkgs/pull/392918 lands + withDtrace ? + lib.meta.availableOn stdenv.hostPlatform libsystemtap + && lib.meta.availableOn stdenv.buildPlatform systemtap-sdt, # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50 withLibseccomp ? lib.meta.availableOn stdenv.hostPlatform libseccomp, libseccomp, @@ -88,6 +95,8 @@ let isLLVMOnly = lib.versionAtLeast version "2.92"; hasExternalLixDoc = lib.versionOlder version "2.92"; isLegacyParser = lib.versionOlder version "2.91"; + hasDtraceSupport = lib.versionAtLeast version "2.93"; + parseToYAML = lib.versionAtLeast version "2.93"; in # gcc miscompiles coroutines at least until 13.2, possibly longer # do not remove this check unless you are sure you (or your users) will not report bugs to Lix upstream about GCC miscompilations. @@ -159,6 +168,8 @@ stdenv.mkDerivation (finalAttrs: { mdbook-linkcheck doxygen ] + ++ lib.optionals (hasDtraceSupport && withDtrace) [ systemtap-sdt ] + ++ lib.optionals parseToYAML [ yq ] ++ lib.optionals stdenv.hostPlatform.isLinux [ util-linuxMinimal ]; buildInputs = @@ -187,7 +198,8 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals stdenv.hostPlatform.isStatic [ llvmPackages.libunwind ] ++ lib.optionals (stdenv.hostPlatform.isx86_64) [ libcpuid ] ++ lib.optionals withLibseccomp [ libseccomp ] - ++ lib.optionals withAWS [ aws-sdk-cpp ]; + ++ lib.optionals withAWS [ aws-sdk-cpp ] + ++ lib.optionals (hasDtraceSupport && withDtrace) [ libsystemtap ]; inherit cargoDeps; @@ -256,6 +268,9 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonOption "state-dir" stateDir) (lib.mesonOption "sysconfdir" confDir) ] + ++ lib.optionals hasDtraceSupport [ + (lib.mesonEnable "dtrace-probes" withDtrace) + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ (lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox") ]; diff --git a/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix b/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix index 3241627f15dc2..07237c34ee3ab 100644 --- a/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix +++ b/pkgs/tools/package-management/lix/common-nix-eval-jobs.nix @@ -11,6 +11,7 @@ lib, lix, boost, + capnproto, nlohmann_json, meson, pkg-config, @@ -23,11 +24,16 @@ stdenv.mkDerivation { pname = "nix-eval-jobs"; version = "${version}${suffix}"; inherit src patches; - buildInputs = [ - nlohmann_json - lix - boost - ]; + sourceRoot = if lib.versionAtLeast version "2.93" then "source/subprojects/nix-eval-jobs" else null; + buildInputs = + [ + nlohmann_json + lix + boost + ] + ++ lib.optionals (lib.versionAtLeast version "2.93") [ + capnproto + ]; nativeBuildInputs = [ meson pkg-config diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 43d873e261291..0273a7561c0e1 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -8,6 +8,7 @@ callPackage, fetchgit, fetchFromGitHub, + fetchFromGitea, rustPlatform, editline, ncurses, @@ -25,7 +26,8 @@ let { attrName, lix-args, - nix-eval-jobs-args, + # Starting with 2.93, `nix-eval-jobs` lives in the `lix` repository. + nix-eval-jobs-args ? { inherit (lix-args) version src; }, }: let # GCC 13.2 is known to miscompile Lix coroutines (introduced in 2.92). @@ -192,7 +194,6 @@ lib.makeExtensible (self: { cargoDeps = rustPlatform.fetchCargoVendor { name = "lix-${version}"; inherit src; - allowGitDependencies = false; hash = "sha256-YMyNOXdlx0I30SkcmdW/6DU0BYc3ZOa2FMJSKMkr7I8="; }; }; @@ -207,7 +208,29 @@ lib.makeExtensible (self: { }; }; - latest = self.lix_2_92; + lix_2_93 = self.makeLixScope { + attrName = "lix_2_93"; + + lix-args = rec { + version = "2.93.0"; + + src = fetchFromGitea { + domain = "git.lix.systems"; + owner = "lix-project"; + repo = "lix"; + rev = version; + hash = "sha256-hsFe4Tsqqg4l+FfQWphDtjC79WzNCZbEFhHI8j2KJzw="; + }; + + cargoDeps = rustPlatform.fetchCargoVendor { + name = "lix-${version}"; + inherit src; + hash = "sha256-YMyNOXdlx0I30SkcmdW/6DU0BYc3ZOa2FMJSKMkr7I8="; + }; + }; + }; + + latest = self.lix_2_93; # Note: This is not yet 2.92 because of a non-deterministic `curl` error. # See: https://git.lix.systems/lix-project/lix/issues/662 From 39529f928b82ecc4e80a504a1cd37831d6c37461 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Thu, 10 Apr 2025 18:11:59 +0200 Subject: [PATCH 4/4] lixPackageSets.git: init at 2.94.0-pre-20250509_dcb0a97000d5 --- maintainers/team-list.nix | 1 + pkgs/tools/package-management/lix/default.nix | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index c46260d483e04..fd2734bc3a5ad 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -869,6 +869,7 @@ with lib.maintainers; qyriad _9999years lf- + alois31 ]; scope = "Maintain the Lix package manager inside of Nixpkgs."; shortName = "Lix ecosystem"; diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix index 0273a7561c0e1..494c35050823f 100644 --- a/pkgs/tools/package-management/lix/default.nix +++ b/pkgs/tools/package-management/lix/default.nix @@ -230,6 +230,28 @@ lib.makeExtensible (self: { }; }; + git = self.makeLixScope { + attrName = "git"; + + lix-args = rec { + version = "2.94.0-pre-20250509_${builtins.substring 0 12 src.rev}"; + + src = fetchFromGitea { + domain = "git.lix.systems"; + owner = "lix-project"; + repo = "lix"; + rev = "dcb0a97000d50b2868ed4f8d9fd465c5a5b8eb3a"; + hash = "sha256-qCRBy8Bbh5XhPalPkhonxNgfsbw3lP0UIXBLSrhxAvI="; + }; + + cargoDeps = rustPlatform.fetchCargoVendor { + name = "lix-${version}"; + inherit src; + hash = "sha256-YMyNOXdlx0I30SkcmdW/6DU0BYc3ZOa2FMJSKMkr7I8="; + }; + }; + }; + latest = self.lix_2_93; # Note: This is not yet 2.92 because of a non-deterministic `curl` error.