forked from renatoGarcia/opencv-swig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
46 lines (36 loc) · 1.05 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
{
stdenv
, fetchgit
, lib
, cmake
}:
let
headerSrc = builtins.readFile ./CMakeLists.txt;
versionNumbersRegex = ".*project[[:space:]]*\\(.*[[:space:]]VERSION[[:space:]]+([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+).*\\).*";
versionNumbers = builtins.head (builtins.match versionNumbersRegex headerSrc);
devHash_ = builtins.match ".*DEV_HASH: ([[:xdigit:]]+).*" headerSrc;
devHash = if devHash_ != null then builtins.head devHash_ else null;
repo = builtins.fetchGit {
url = https://github.com/renatoGarcia/opencv-swig.git;
ref = "master";
rev = devHash;
};
version =
versionNumbers +
(
if devHash != null
then "+dev." + toString repo.revCount
else "+local_repo"
);
in stdenv.mkDerivation {
pname = "opencv-swig";
inherit version;
src = ./.;
nativeBuildInputs = [ cmake ];
meta = with lib; {
homepage = "https://github.com/renatoGarcia/opencv-swig";
description = "A SWIG library for OpenCV types";
license = licenses.bsd3;
maintainers = with maintainers; [ renatoGarcia ];
};
}