Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
jax
jax-tvm-ffi
kernel-abi-check
kernels-data
matplotlib
mktestdocs
openssl.dev
Expand Down
2 changes: 2 additions & 0 deletions nix-builder/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ in

kernels = callPackage ./pkgs/python-modules/kernels { };

kernels-data = callPackage ./pkgs/python-modules/kernels-data { };

pyclibrary = python-self.callPackage ./pkgs/python-modules/pyclibrary { };

mkTorch = callPackage ./pkgs/python-modules/torch/binary { };
Expand Down
13 changes: 13 additions & 0 deletions nix-builder/pkgs/crate-dirs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ lib, sourceFiles }:

with lib.fileset;
toSource {
root = ../..;
fileset = unions [
../../Cargo.lock
../../Cargo.toml
(fileFilter sourceFiles ../../kernel-abi-check)
(fileFilter sourceFiles ../../kernel-builder)
(fileFilter sourceFiles ../../kernels-data)
];
}
13 changes: 2 additions & 11 deletions nix-builder/pkgs/kernel-abi-check/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,8 @@ rustPlatform.buildRustPackage {
|| file.hasExt "rs"
|| file.name == "stable_abi.toml";
in
with lib.fileset;
toSource {
root = ../../..;
fileset = unions [
../../../Cargo.lock
../../../Cargo.toml
(fileFilter sourceFiles ../../../kernel-abi-check)
# Cargo wants access to the whole workspace.
(fileFilter sourceFiles ../../../kernel-builder)
(fileFilter sourceFiles ../../../kernels-data)
];
import ../crate-dirs.nix {
inherit lib sourceFiles;
};

cargoLock = {
Expand Down
13 changes: 2 additions & 11 deletions nix-builder/pkgs/kernel-builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,8 @@ rustPlatform.buildRustPackage {
"toml"
]);
in
with lib.fileset;
toSource {
root = ../../..;
fileset = unions [
../../../Cargo.lock
../../../Cargo.toml
(fileFilter sourceFiles ../../../kernel-builder)
# Cargo wants access to the whole workspace.
(fileFilter sourceFiles ../../../kernel-abi-check)
(fileFilter sourceFiles ../../../kernels-data)
];
import ../crate-dirs.nix {
inherit lib sourceFiles;
};

cargoLock = {
Expand Down
13 changes: 2 additions & 11 deletions nix-builder/pkgs/python-modules/kernel-abi-check/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,8 @@ buildPythonPackage {
|| file.hasExt "rs"
|| file.name == "stable_abi.toml";
in
with lib.fileset;
toSource {
root = ../../../..;
fileset = unions [
../../../../Cargo.lock
../../../../Cargo.toml
(fileFilter sourceFiles ../../../../kernel-abi-check)
# Cargo wants access to the whole workspace.
(fileFilter sourceFiles ../../../../kernel-builder)
(fileFilter sourceFiles ../../../../kernels-data)
];
import ../../crate-dirs.nix {
inherit lib sourceFiles;
};

cargoDeps = rustPlatform.importCargoLock {
Expand Down
52 changes: 52 additions & 0 deletions nix-builder/pkgs/python-modules/kernels-data/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
lib,
buildPythonPackage,
rustPlatform,
}:

let
version =
(builtins.fromTOML (builtins.readFile ../../../../kernels-data/Cargo.toml)).package.version;
cargoFlags = [
"-m"
"kernels-data/bindings/python/Cargo.toml"
];
in
buildPythonPackage {
pname = "kernels-data";
inherit version;
format = "pyproject";

src =
let
sourceFiles =
file:
file.name == "Cargo.toml"
|| file.name == "Cargo.lock"
|| file.hasExt "pyi"
|| file.name == "pyproject.toml"
|| file.name == "python_dependencies.json"
|| file.hasExt "rs";
in
import ../../crate-dirs.nix {
inherit lib sourceFiles;
};

cargoDeps = rustPlatform.importCargoLock {
lockFile = ../../../../Cargo.lock;
outputHashes = {
"huggingface-hub-0.0.1" = "sha256-By8b1NUPWu+XF3Om1NcEO+o2qdZUco+FxvrJGNRqxWs=";
};
};

maturinBuildFlags = cargoFlags;

build-system = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];

meta = with lib; {
description = "Kernels data structures";
};
}
Loading