1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cargo,
6 fetchFromGitHub,
7 frelatage,
8 libiconv,
9 pytestCheckHook,
10 pythonOlder,
11 rustc,
12 rustPlatform,
13}:
14
15buildPythonPackage rec {
16 pname = "base2048";
17 version = "0.1.3";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "ionite34";
24 repo = "base2048";
25 tag = "v${version}";
26 hash = "sha256-OXlfycJB1IrW2Zq0xPDGjjwCdRTWtX/ixPGWcd+YjAg=";
27 };
28
29 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
30
31 postPatch = ''
32 ln -s ${./Cargo.lock} Cargo.lock
33 '';
34
35 nativeBuildInputs = [
36 cargo
37 rustPlatform.cargoSetupHook
38 rustPlatform.maturinBuildHook
39 rustc
40 ];
41
42 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
43
44 optional-dependencies = {
45 fuzz = [ frelatage ];
46 };
47
48 nativeCheckInputs = [ pytestCheckHook ];
49
50 pythonImportsCheck = [ "base2048" ];
51
52 meta = with lib; {
53 description = "Binary encoding with base-2048 in Python with Rust";
54 homepage = "https://github.com/ionite34/base2048";
55 changelog = "https://github.com/ionite34/base2048/releases/tag/v${version}";
56 license = licenses.mit;
57 maintainers = with maintainers; [ fab ];
58 };
59}