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