diff --git a/build2cmake/src/config/v2.rs b/build2cmake/src/config/v2.rs index 606f3177..b4dfa075 100644 --- a/build2cmake/src/config/v2.rs +++ b/build2cmake/src/config/v2.rs @@ -51,6 +51,15 @@ pub struct General { pub cuda_maxver: Option, pub cuda_minver: Option, + + pub hub: Option, +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields, rename_all = "kebab-case")] +pub struct Hub { + pub repo_id: Option, + pub branch: Option, } #[derive(Debug, Deserialize, Clone, Serialize)] @@ -249,6 +258,7 @@ impl General { universal, cuda_maxver: None, cuda_minver: None, + hub: None, } } } diff --git a/lib/gen-flake-outputs.nix b/lib/gen-flake-outputs.nix index d7c1a82b..15418879 100644 --- a/lib/gen-flake-outputs.nix +++ b/lib/gen-flake-outputs.nix @@ -158,6 +158,22 @@ in chmod -R +w build ''; + build-and-upload = + let + buildToml = build.readBuildConfig path; + repo_id = lib.attrByPath [ + "general" + "hub" + "repo-id" + ] "kernels-community/${buildToml.general.name}" buildToml; + branch = lib.attrByPath [ "general" "hub" "branch" ] "main" buildToml; + 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} + ''; + ci = let setsWithFramework = diff --git a/overlay.nix b/overlay.nix index 4b40f978..427895a2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -18,6 +18,17 @@ final: prev: { ( python-self: python-super: with python-self; { kernel-abi-check = callPackage ./pkgs/python-modules/kernel-abi-check { }; + + kernels = python-super.kernels.overrideAttrs (oldAttrs: { + version = "unstable"; + + src = final.fetchFromGitHub { + owner = "huggingface"; + repo = "kernels"; + rev = "5d21b86a5d611100c10c10b79ffa7965edf567fd"; + sha256 = "sha256-lKQUVbjhpeXKj1SeZRxgPSsOtBUZ7zQeO6pRoA1h+W8="; + }; + }); } ) ];