summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/uplc/default.nix
blob: 127f75b41ec24a35c12b1cb9be399962ddb875ff (plain)
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
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  # Python deps
  frozenlist2,
  python-secp256k1-cardano,
  setuptools,
  poetry-core,
  frozendict,
  cbor2WithoutCExtensions,
  cbor2,
  rply,
  pycardano,
  uplc,
}:

buildPythonPackage rec {
  pname = "uplc";
  version = "1.0.10";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "OpShin";
    repo = "uplc";
    tag = version;
    hash = "sha256-Owo4W4jChrdYnz11BbWQdm2SiwFwOJlqjYutuRyjpxs=";
  };

  propagatedBuildInputs = [
    setuptools
    poetry-core
    frozendict
    cbor2
    frozenlist2
    rply
    pycardano
    python-secp256k1-cardano
  ];

  # Support cbor2 without C extensions
  postPatch = lib.optionalString (!cbor2.withCExtensions) ''
    substituteInPlace uplc/ast.py --replace-fail 'from _cbor2' 'from cbor2'
  '';

  pythonImportsCheck = [ "uplc" ];

  passthru.tests.withoutCExtensions = uplc.override {
    cbor2 = cbor2WithoutCExtensions;
  };

  meta = {
    description = "Python implementation of untyped plutus language core";
    homepage = "https://github.com/OpShin/uplc";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ aciceri ];
    mainProgram = "opshin";
  };
}