Skip to content

Commit ae5d9c4

Browse files
committed
Add doctr to Nix dependencies
1 parent e8c07e2 commit ae5d9c4

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

nix/dependencies.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
let
2626
python_packages = my_python.pkgs;
2727
unstable_python_packages = unstable_pkgs.my_python.pkgs;
28+
python_doctr = pkgs.callPackage ./packages/doctr.nix {
29+
pkgs = pkgs;
30+
my_python = my_python;
31+
};
2832
in {
2933
pkgs = pkgs;
3034
lib = lib;
@@ -34,6 +38,7 @@ in {
3438
python_packages.numpy
3539
python_packages.torch-bin
3640
unstable_python_packages.pytorch-lightning
41+
python_doctr
3742
cudatoolkit
3843
];
3944
}

nix/packages/doctr.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{ pkgs ? import <nixpkgs> {}
2+
, lib ? pkgs.lib
3+
, my_python ? pkgs.python311
4+
, buildPythonPackage ? my_python.pkgs.buildPythonPackage
5+
, fetchFromGitHub ? pkgs.fetchFromGitHub }:
6+
7+
buildPythonPackage rec {
8+
pname = "doctr";
9+
version = "0.8.1"; # Update this to the latest release version
10+
11+
src = fetchFromGitHub {
12+
owner = "mindee";
13+
repo = pname;
14+
rev = "v${version}";
15+
sha256 = "rlIGq5iHDAEWy1I0sAXVSN2/Jh2ub/xLCLCLLp7+9ik="; # You can generate this with nix-prefetch-github
16+
};
17+
18+
nativeBuildInputs = [ my_python.pkgs.setuptools ];
19+
propagatedBuildInputs = [ my_python.pkgs.torch ];
20+
21+
22+
postInstall = let
23+
libPath = "lib/${my_python.libPrefix}/site-packages";
24+
in
25+
''
26+
mkdir -p $out/nix-support
27+
echo "$out/${libPath}" > "$out/nix-support/propagated-build-inputs"
28+
'';
29+
30+
doCheck = false;
31+
32+
meta = with lib; {
33+
description = "Doctr Python package";
34+
homepage = https://github.com/mindee/doctr;
35+
license = licenses.asl20; # Update as per project's licensing
36+
maintainers = [ ]; # You need to add your name to the list of Nix maintainers
37+
};
38+
}

0 commit comments

Comments
 (0)