Skip to content

Commit 7b44a79

Browse files
committedMar 21, 2025
lix: package nix-eval-jobs
This adds packaging for the Lix fork of `nix-eval-jobs`. `lixVersions.lix_2_91` has been renamed to `lixPackages_2_91.lix`. The elements of `lixPackageSets` are proper scopes instead of single packages. This makes it easy to build `nix-eval-jobs` against the correct version of Lix.
1 parent 30358ab commit 7b44a79

File tree

5 files changed

+174
-50
lines changed

5 files changed

+174
-50
lines changed
 

‎pkgs/tools/package-management/lix/common.nix ‎pkgs/tools/package-management/lix/common-lix.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
lib,
3-
fetchFromGitHub,
43
suffix ? "",
54
version,
65
src,
76
docCargoDeps,
87
patches ? [ ],
98
maintainers ? lib.teams.lix.members,
109
}@args:
10+
1111
{
1212
stdenv,
1313
meson,
@@ -67,6 +67,7 @@
6767
stateDir,
6868
storeDir,
6969
}:
70+
7071
let
7172
isLegacyParser = lib.versionOlder version "2.91";
7273
in
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# NOTE: Eventually this should probably be renamed `common-lix-eval-jobs.nix`.
2+
{
3+
lib,
4+
suffix ? "",
5+
version,
6+
src,
7+
patches ? [ ],
8+
maintainers ? lib.teams.lix.members,
9+
}@args:
10+
11+
{
12+
stdenv,
13+
lib,
14+
lix,
15+
boost,
16+
nlohmann_json,
17+
meson,
18+
pkg-config,
19+
ninja,
20+
cmake,
21+
clang-tools,
22+
}:
23+
24+
stdenv.mkDerivation {
25+
# TODO: Should this be called `lix-eval-jobs`?
26+
pname = "nix-eval-jobs";
27+
version = "${version}${suffix}";
28+
inherit src patches;
29+
buildInputs = [
30+
nlohmann_json
31+
lix
32+
boost
33+
];
34+
nativeBuildInputs = [
35+
meson
36+
pkg-config
37+
ninja
38+
# nlohmann_json can be only discovered via cmake files
39+
cmake
40+
] ++ (lib.optional stdenv.cc.isClang [ clang-tools ]);
41+
42+
# point 'nix edit' and ofborg at the file that defines the attribute,
43+
# not this common file.
44+
pos = builtins.unsafeGetAttrPos "version" args;
45+
meta = {
46+
description = "Hydra's builtin `hydra-eval-jobs` as a standalone tool";
47+
homepage =
48+
# Starting with 2.93, `nix-eval-jobs` lives in the `lix` repository.
49+
if lib.versionAtLeast version "2.93" then
50+
"https://git.lix.systems/lix-project/lix/src/branch/main/subprojects/nix-eval-jobs"
51+
else
52+
"https://git.lix.systems/lix-project/nix-eval-jobs";
53+
license = lib.licenses.gpl3;
54+
inherit maintainers;
55+
platforms = lib.platforms.unix;
56+
};
57+
}

‎pkgs/tools/package-management/lix/default.nix

+106-47
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,81 @@
33
aws-sdk-cpp,
44
boehmgc,
55
callPackage,
6+
fetchgit,
67
fetchFromGitHub,
78
rustPlatform,
89
Security,
10+
newScope,
911

1012
storeDir ? "/nix/store",
1113
stateDir ? "/nix/var",
1214
confDir ? "/etc",
1315
}:
1416
let
15-
boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
16-
17-
boehmgc-nix = boehmgc-nix_2_3.overrideAttrs (drv: {
18-
patches = (drv.patches or [ ]) ++ [
19-
# Part of the GC solution in https://github.com/NixOS/nix/pull/4944
20-
../nix/patches/boehmgc-coroutine-sp-fallback.patch
21-
];
22-
});
23-
24-
aws-sdk-cpp-nix =
25-
(aws-sdk-cpp.override {
26-
apis = [
27-
"s3"
28-
"transfer"
29-
];
30-
customMemoryManagement = false;
31-
}).overrideAttrs
32-
{
33-
# only a stripped down version is build which takes a lot less resources to build
34-
requiredSystemFeatures = [ ];
35-
};
17+
makeLixScope =
18+
{
19+
lix,
20+
nix-eval-jobs,
21+
}:
22+
lib.makeScope newScope (
23+
self:
24+
lib.recurseIntoAttrs {
25+
inherit
26+
Security
27+
storeDir
28+
stateDir
29+
confDir
30+
;
31+
32+
boehmgc =
33+
# TODO: Why is this called `boehmgc-nix_2_3`?
34+
let
35+
boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
36+
in
37+
# Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either.
38+
if lib.versionOlder lix.version "2.91" then
39+
boehmgc-nix_2_3.overrideAttrs (drv: {
40+
patches = (drv.patches or [ ]) ++ [
41+
# Part of the GC solution in https://github.com/NixOS/nix/pull/4944
42+
../nix/patches/boehmgc-coroutine-sp-fallback.patch
43+
];
44+
})
45+
else
46+
boehmgc-nix_2_3;
47+
48+
aws-sdk-cpp =
49+
(aws-sdk-cpp.override {
50+
apis = [
51+
"s3"
52+
"transfer"
53+
];
54+
customMemoryManagement = false;
55+
}).overrideAttrs
56+
{
57+
# only a stripped down version is build which takes a lot less resources to build
58+
requiredSystemFeatures = [ ];
59+
};
60+
61+
# NOTE: The `common-*.nix` helpers contain a top-level function which
62+
# takes the Lix source to build and version information. We use the
63+
# outer `callPackage` for that.
64+
#
65+
# That *returns* another function which takes the actual build
66+
# dependencies, and that uses the new scope's `self.callPackage` so
67+
# that `nix-eval-jobs` can be built against the correct `lix` version.
68+
lix = self.callPackage (callPackage ./common-lix.nix lix) { };
69+
70+
# TODO: Should this be named `lix-eval-jobs`?
71+
nix-eval-jobs = self.callPackage (callPackage ./common-nix-eval-jobs.nix nix-eval-jobs) { };
72+
}
73+
);
3674

37-
# Since Lix 2.91 does not use boost coroutines, it does not need boehmgc patches either.
38-
needsBoehmgcPatches = version: lib.versionOlder version "2.91";
39-
40-
common =
41-
args:
42-
callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) {
43-
inherit
44-
Security
45-
storeDir
46-
stateDir
47-
confDir
48-
;
49-
boehmgc = if needsBoehmgcPatches args.version then boehmgc-nix else boehmgc-nix_2_3;
50-
aws-sdk-cpp = aws-sdk-cpp-nix;
51-
};
5275
in
5376
lib.makeExtensible (self: {
54-
buildLix = common;
77+
makeLixScope = makeLixScope;
5578

56-
lix_2_90 = (
57-
common rec {
79+
"2.90" = self.makeLixScope {
80+
lix = rec {
5881
version = "2.90.0";
5982

6083
src = fetchFromGitHub {
@@ -71,11 +94,21 @@ lib.makeExtensible (self: {
7194
sourceRoot = "${src.name or src}/lix-doc";
7295
hash = "sha256-VPcrf78gfLlkTRrcbLkPgLOk0o6lsOJBm6HYLvavpNU=";
7396
};
74-
}
75-
);
97+
};
7698

77-
lix_2_91 = (
78-
common rec {
99+
nix-eval-jobs = {
100+
version = "2.90.0";
101+
src = fetchgit {
102+
url = "https://git.lix.systems/lix-project/nix-eval-jobs.git";
103+
# https://git.lix.systems/lix-project/nix-eval-jobs/commits/branch/release-2.90
104+
rev = "9c23772cf25e0d891bef70b7bcb7df36239672a5";
105+
hash = "sha256-oT273pDmYzzI7ACAFUOcsxtT6y34V5KF7VBSqTza7j8=";
106+
};
107+
};
108+
};
109+
110+
"2.91" = self.makeLixScope {
111+
lix = rec {
79112
version = "2.91.1";
80113

81114
src = fetchFromGitHub {
@@ -92,9 +125,35 @@ lib.makeExtensible (self: {
92125
sourceRoot = "${src.name or src}/lix-doc";
93126
hash = "sha256-U820gvcbQIBaFr2OWPidfFIDXycDFGgXX1NpWDDqENs=";
94127
};
95-
}
96-
);
128+
};
129+
130+
nix-eval-jobs = {
131+
version = "2.91.0";
132+
src = fetchgit {
133+
url = "https://git.lix.systems/lix-project/nix-eval-jobs.git";
134+
# https://git.lix.systems/lix-project/nix-eval-jobs/commits/branch/release-2.91
135+
rev = "1f98b0c016a6285f29ad278fa5cd82b8f470d66a";
136+
hash = "sha256-ZJKOC/iLuO8qjPi9/ql69Vgh3NIu0tU6CSI0vbiCrKA=";
137+
};
138+
};
139+
};
97140

98-
latest = self.lix_2_91;
99-
stable = self.lix_2_91;
141+
latest = self."2.91";
142+
stable = self."2.91";
143+
144+
# Previously, `nix-eval-jobs` was not packaged here, so we export an
145+
# attribute with the previously-expected structure for compatibility. This
146+
# is also available (for now) as `pkgs.lixVersions`.
147+
renamedDeprecatedLixVersions =
148+
let
149+
mkAlias =
150+
v1: v2: lib.warnOnInstantiate "'lixVersions.${v1}' has been renamed to 'lixPackages_${v2}.lix'";
151+
in
152+
lib.dontRecurseIntoAttrs {
153+
lix_2_90 = mkAlias "lix_2_90" "2_90" self."2.90".lix;
154+
lix_2_91 = mkAlias "lix_2_91" "2_91" self."2.91".lix;
155+
# NOTE: Do not add new versions of Lix here.
156+
stable = mkAlias "stable" "stable" self.stable.lix;
157+
latest = mkAlias "latest" "latest" self.latest.lix;
158+
};
100159
})

‎pkgs/top-level/aliases.nix

+2
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ mapAliases {
910910

911911
linuxstopmotion = stopmotion; # Added 2024-11-01
912912

913+
lixVersions = lixPackageSets.renamedDeprecatedLixVersions; # Added 2025-03-20, warning in ../tools/package-management/lix/default.nix
914+
913915
llvmPackages_git = (callPackages ../development/compilers/llvm { }).git;
914916

915917
lld_9 = throw "lld_9 has been removed from nixpkgs"; # Added 2024-04-08

‎pkgs/top-level/all-packages.nix

+7-2
Original file line numberDiff line numberDiff line change
@@ -17497,13 +17497,18 @@ with pkgs;
1749717497

1749817498
nixStatic = pkgsStatic.nix;
1749917499

17500-
lixVersions = recurseIntoAttrs (callPackage ../tools/package-management/lix {
17500+
lixPackageSets = recurseIntoAttrs (callPackage ../tools/package-management/lix {
1750117501
storeDir = config.nix.storeDir or "/nix/store";
1750217502
stateDir = config.nix.stateDir or "/nix/var";
1750317503
inherit (darwin.apple_sdk.frameworks) Security;
1750417504
});
1750517505

17506-
lix = lixVersions.stable;
17506+
lixPackages_2_90 = lixPackageSets."2.90";
17507+
lixPackages_2_91 = lixPackageSets."2.91";
17508+
lixPackages_stable = lixPackageSets.stable;
17509+
lixPackages_latest = lixPackageSets.latest;
17510+
17511+
lix = lixPackages_stable.lix;
1750717512

1750817513
lixStatic = pkgsStatic.lix;
1750917514

0 commit comments

Comments
 (0)
Failed to load comments.