-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathdefault.nix
More file actions
85 lines (76 loc) · 1.72 KB
/
default.nix
File metadata and controls
85 lines (76 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
lib,
installShellFiles,
rustPlatform,
pkg-config,
libgit2,
openssl,
}:
let
version =
(builtins.fromTOML (builtins.readFile ../../../kernel-builder/Cargo.toml)).package.version;
cargoFlags = [
"-p"
"hf-kernel-builder"
];
in
rustPlatform.buildRustPackage {
inherit version;
pname = "kernel-builder";
src =
let
sourceFiles =
file:
file.name == "Cargo.toml"
|| file.name == "Cargo.lock"
|| file.name == "flake.nix"
|| file.name == "pyproject.toml"
|| file.name == "pyproject_universal.toml"
|| file.name == "python_dependencies.json"
|| file.name == ".gitattributes"
|| file.name == ".gitignore"
|| (builtins.any file.hasExt [
"cmake"
"cpp"
"cu"
"h"
"in"
"md"
"metal"
"mm"
"py"
"rs"
"toml"
]);
in
import ../crate-dirs.nix {
inherit lib sourceFiles;
};
cargoLock = {
lockFile = ../../../Cargo.lock;
outputHashes = {
"huggingface-hub-0.0.1" = "sha256-By8b1NUPWu+XF3Om1NcEO+o2qdZUco+FxvrJGNRqxWs=";
};
};
cargoBuildFlags = cargoFlags;
cargoTestFlags = cargoFlags;
# e2e tests look for binary at target/debug/ which doesn't exist in nix
doCheck = false;
nativeBuildInputs = [
installShellFiles
pkg-config
];
buildInputs = [
libgit2
openssl.dev
];
postInstall = ''
for shell in bash fish zsh; do
$out/bin/kernel-builder completions $shell > kernel-builder.$shell
done
installShellCompletion kernel-builder.{bash,fish,zsh}
'';
meta = {
description = "Create cmake build infrastructure from build.toml files";
};
}