Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Commit a4b8b5b

Browse files
authored
Remove duplicate build variant name code (#285)
1 parent fa2380b commit a4b8b5b

3 files changed

Lines changed: 9 additions & 44 deletions

File tree

flake.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
};
119119
inherit (nixpkgs) lib;
120120

121-
buildVersion = import ./lib/build-version.nix;
121+
buildName = (import ./lib/build-variants.nix { inherit lib; }).buildName;
122122

123123
buildSets = defaultBuildSetsPerSystem.${system};
124124

@@ -152,11 +152,12 @@
152152
++ allOutputs python3Packages.kernels
153153
++ lib.optionals stdenv.hostPlatform.isLinux (allOutputs stdenvGlibc_2_27)
154154
);
155-
buildSetLinkFarm = buildSet: pkgs.linkFarm (buildVersion buildSet) (buildSetOutputs buildSet);
155+
buildSetLinkFarm =
156+
buildSet: pkgs.linkFarm (buildName buildSet.buildConfig) (buildSetOutputs buildSet);
156157
in
157158
pkgs.linkFarm "packages-for-cache" (
158159
map (buildSet: {
159-
name = buildVersion buildSet;
160+
name = buildName (buildSet.buildConfig);
160161
path = buildSetLinkFarm buildSet;
161162
}) buildSets
162163
);
@@ -182,7 +183,7 @@
182183
# This package set is exposed so that we can prebuild the Torch versions.
183184
torch = builtins.listToAttrs (
184185
map (buildSet: {
185-
name = buildVersion buildSet;
186+
name = buildName (buildSet.buildConfig);
186187
value = buildSet.torch;
187188
}) buildSets
188189
);

lib/build-version.nix

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/build.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
let
1414
abi = torch: if torch.passthru.cxx11Abi then "cxx11" else "cxx98";
15-
torchBuildVersion = import ./build-version.nix;
15+
buildName = (import ./build-variants.nix { inherit lib; }).buildName;
1616
supportedCudaCapabilities = builtins.fromJSON (
1717
builtins.readFile ../build2cmake/src/cuda_supported_archs.json
1818
);
@@ -171,7 +171,7 @@ rec {
171171
extensionForTorch =
172172
{ path, rev }:
173173
buildSet: {
174-
name = torchBuildVersion buildSet;
174+
name = buildName buildSet.buildConfig;
175175
value = mkTorchExtension buildSet {
176176
inherit path rev doGetKernelCheck;
177177
stripRPath = true;
@@ -235,7 +235,7 @@ rec {
235235
mkShell = pkgs.mkShell.override { inherit (buildSet.extension) stdenv; };
236236
in
237237
{
238-
name = torchBuildVersion buildSet;
238+
name = buildName buildSet.buildConfig;
239239
value = mkShell {
240240
nativeBuildInputs = with pkgs; pythonNativeCheckInputs python3.pkgs;
241241

@@ -275,7 +275,7 @@ rec {
275275
mkShell = pkgs.mkShell.override { inherit (buildSet.extension) stdenv; };
276276
in
277277
{
278-
name = torchBuildVersion buildSet;
278+
name = buildName buildSet.buildConfig;
279279
value = mkShell {
280280
nativeBuildInputs =
281281
with pkgs;

0 commit comments

Comments
 (0)