-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
78 lines (64 loc) · 1.91 KB
/
default.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{ stdenv
, callPackage
, defaultCrateOverrides
, fetchFromGitHub
, python
# Build inputs
, darwin
# Propagated build inputs
, numpy
# Check inputs
, pytest
}:
let
mozillaOverlay = fetchFromGitHub {
owner = "mozilla";
repo = "nixpkgs-mozilla";
rev = "9f35c4b09fd44a77227e79ff0c1b4b6a69dff533";
sha256 = "18h0nvh55b5an4gmlgfbvwbyqj91bklf1zymis6lbdh75571qaz0";
};
mozilla = callPackage "${mozillaOverlay.out}/package-set.nix" {};
rustNightly = (mozilla.rustChannelOf { date = "2019-07-19"; channel = "nightly"; }).rust;
src = fetchFromGitHub {
owner = "finalfusion";
repo = "finalfusion-python";
rev = "0.5.0";
sha256 = "1kkpq8s5bn4gd65gxqxfzi1i4cv8pii0kcr3k0kxybdadqqi5p8a";
};
cargo_nix = callPackage ./finalfusion.nix {};
in
cargo_nix.rootCrate.build.override {
rust = rustNightly;
crateOverrides = defaultCrateOverrides // {
finalfusion-python = attr: rec {
inherit src;
pname = "finalfusion";
name = "${python.libPrefix}-${pname}-${attr.version}";
buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.Security;
propagatedBuildInputs = [ numpy ];
installCheckInputs = [ pytest ];
doInstallCheck = true;
installPhase = let
sitePackages = python.sitePackages;
sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary;
in ''
mkdir -p "$out/${sitePackages}"
cp target/lib/libfinalfusion-*${sharedLibrary} \
"$out/${sitePackages}/finalfusion.so"
export PYTHONPATH="$out/${sitePackages}:$PYTHONPATH"
'';
installCheckPhase = ''
pytest
'';
meta = with stdenv.lib; {
description = "Python module for the finalfusion embedding format";
license = licenses.asl20;
maintainers = with maintainers; [ danieldk ];
platforms = platforms.all;
};
};
pyo3 = attr: {
buildInputs = [ python ];
};
};
}