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

Commit 988d90b

Browse files
committed
Generate empty bundle when there is no matching framework
Before this change building `.#ci` when there is no matching backend (e.g. when building a CUDA kernel on macOS) would fail with a Nix evaluation error. Change this to return an empty bundle in such cases.
1 parent ca7654a commit 988d90b

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

flake.nix

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
mkBuildPerSystem =
4444
buildSetPerSystem:
4545
builtins.mapAttrs (
46-
system: buildSet:
47-
import lib/build.nix {
48-
inherit (nixpkgs) lib;
49-
}
46+
system: buildSet: nixpkgs.legacyPackages.${system}.callPackage lib/build.nix { }
5047
) buildSetPerSystem;
5148

5249
defaultBuildPerSystem = mkBuildPerSystem defaultBuildSetsPerSystem;
@@ -113,9 +110,7 @@
113110
system:
114111
let
115112
# Plain nixkpgs that we use to access utility funtions.
116-
pkgs = import nixpkgs {
117-
inherit system;
118-
};
113+
pkgs = nixpkgs.legacyPackages.${system};
119114
inherit (nixpkgs) lib;
120115

121116
buildName = (import ./lib/build-variants.nix { inherit lib; }).buildName;

lib/build.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
lib,
3+
pkgs,
34

45
# Every `buildSets` argument is a list of build sets. Each build set is
56
# a attrset of the form
@@ -195,7 +196,6 @@ rec {
195196
}:
196197
let
197198
# We just need to get any nixpkgs for use by the path join.
198-
pkgs = (builtins.head buildSets).pkgs;
199199
extensions = mkDistTorchExtensions {
200200
inherit
201201
buildSets

lib/join-paths/default.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@ let
2222
mkdir -p ${placeholder "out"}/${path}
2323
cp -r ${pkg}/* ${placeholder "out"}/${path}
2424
'';
25+
prelude = ''
26+
mkdir -p ${placeholder "out"}
27+
'';
2528
in
26-
pkgs.runCommand name args_ (lib.concatStringsSep "\n" (lib.mapAttrsToList copyPath namePaths))
29+
pkgs.runCommand name args_ (
30+
prelude + lib.concatStringsSep "\n" (lib.mapAttrsToList copyPath namePaths)
31+
)

0 commit comments

Comments
 (0)