Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions lib/gen-flake-outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ let
else
builtins.head buildSetsSorted;
shellTorch = bestBuildSet.torch.variant;
# We need a package set for some outputs (e.g. kernels and build-and-upload),
# even when there is no applicable build set.
pkgs =
let
sorted = lib.sort configCompare (addSortOrder buildSets);
in
if sorted == [ ] then
throw "No build set is available for this system"
else
(builtins.head sorted).pkgs;
headOrEmpty = l: if l == [ ] then [ ] else [ (builtins.head l) ];
in
{
Expand Down Expand Up @@ -188,11 +198,17 @@ in
"repo-id"
] "kernels-community/${buildToml.general.name}" buildToml;
branch = lib.attrByPath [ "general" "hub" "branch" ] "main" buildToml;
# `kernels upload` fails when there are no build variants to upload.
# However, we do not want this command to error out in that case, so
# only insert the upload command when there is something to upload.
uploadStr = lib.optionalString (applicableBuildSets != [ ]) ''
${pkgs.python3.pkgs.kernels}/bin/kernels upload --repo-id ${repo_id} --branch ${branch} ${bundle}
'';
in
writeScriptBin "build-and-upload" ''
#!/usr/bin/env bash
set -euo pipefail
${bestBuildSet.pkgs.python3.pkgs.kernels}/bin/kernels upload --repo-id ${repo_id} --branch ${branch} ${bundle}
${uploadStr}
'';

ci =
Expand All @@ -214,7 +230,7 @@ in
};

kernels =
bestBuildSet.pkgs.python3.withPackages (
pkgs.python3.withPackages (
ps: with ps; [
kernel-abi-check
kernels
Expand Down
Loading