This repository has been archived by the owner on Dec 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.nix
60 lines (53 loc) · 1.56 KB
/
tests.nix
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
{
pkgs ? import (import ./nix/sources.nix).nixpkgs {
config = {
allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [
"libtorch"
];
};
}
}:
let
sources = import ./nix/sources.nix;
models = import ./nix/models.nix;
crateOverrides = with pkgs; defaultCrateOverrides // {
hdf5-sys = attr: {
HDF5_DIR = symlinkJoin { name = "hdf5-join"; paths = [ hdf5.dev hdf5.out ]; };
};
sticker2 = attr: {
buildInputs = [ libtorch-bin ] ++
lib.optional stdenv.isDarwin darwin.Security;
} // models;
sticker2-utils = attr: {
buildInputs = [ libtorch-bin ] ++
lib.optional stdenv.isDarwin darwin.Security;
};
sentencepiece-sys = attr: {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ sentencepiece ];
};
torch-sys = attr: {
buildInputs = lib.optional stdenv.isDarwin curl;
LIBTORCH = "${libtorch-bin.dev}";
};
};
buildRustCrate = pkgs.buildRustCrate.override {
defaultCrateOverrides = crateOverrides;
};
crateTools = import "${sources.crate2nix}/tools.nix" {};
cargoNix = pkgs.callPackage (crateTools.generatedCargoNix {
name = "sticker2";
src = pkgs.nix-gitignore.gitignoreSource [ ".git/" "nix/" "*.nix" ] ./.;
}) {
inherit buildRustCrate;
};
in with pkgs; lib.flatten (lib.mapAttrsToList (_: drv: [
(drv.build.override {
features = [ "model-tests" ];
runTests = true;
})
(drv.build.override {
features = [ "load-hdf5" "model-tests" "tensorboard" ];
runTests = true;
})
]) cargoNix.workspaceMembers)