This repository was archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefault.nix
More file actions
84 lines (63 loc) · 1.91 KB
/
default.nix
File metadata and controls
84 lines (63 loc) · 1.91 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
{
callPackage
, stdenv
, defaultCrateOverrides
, nix-gitignore
, curl
, darwin
, python3Packages
, pkgconfig
, releaseBuild ? true
}:
let
libtensorflow_1_14_0 = (callPackage ./nix/sticker.nix {}).libtensorflow_1_14_0;
rustNightly = callPackage ./nix/rust-nightly.nix {};
cargo_nix = callPackage ./nix/Cargo.nix {};
in cargo_nix.rootCrate.build.override {
rust = rustNightly;
release = releaseBuild;
buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.Security;
crateOverrides = defaultCrateOverrides // {
sticker-python = attr: rec {
pname = "sticker-python";
name = "${pname}-${attr.version}";
type = [ "cdylib" ];
src = nix-gitignore.gitignoreSource [ ".git/" "*.nix" "/nix" ] ./.;
installCheckInputs = [ python3Packages.pytest ];
doInstallCheck = true;
installPhase = let
sitePackages = python3Packages.python.sitePackages;
sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary;
in ''
runHook preInstall
mkdir -p "$out/${sitePackages}"
cp target/lib/libsticker_python*${sharedLibrary} \
"$out/${sitePackages}/sticker.so"
export PYTHONPATH="$out/${sitePackages}:$PYTHONPATH"
runHook postInstall
'';
installCheckPhase = ''
runHook preInstallCheck
pytest
runHook postInstallCheck
'';
meta = with stdenv.lib; {
description = "Python module for the sticker sequence labeler";
license = licenses.asl20;
platforms = platforms.all;
};
};
sticker-utils = attr: {
# We only care for the library part of sticker-utils.
crateBin = [];
};
pyo3 = attr: {
buildInputs = [ python3Packages.python ];
};
tensorflow-sys = attrs: {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libtensorflow_1_14_0 ] ++
stdenv.lib.optional stdenv.isDarwin curl;
};
};
}