1 | # package https://gitlab.com/tahoe-lafs/pycddl |
---|
2 | # |
---|
3 | # also in the process of being pushed upstream |
---|
4 | # https://github.com/NixOS/nixpkgs/pull/221220 |
---|
5 | # |
---|
6 | # we should switch to the upstream package when it is available from our |
---|
7 | # minimum version of nixpkgs. |
---|
8 | # |
---|
9 | # if you need to update this package to a new pycddl release then |
---|
10 | # |
---|
11 | # 1. change value given to `buildPythonPackage` for `version` to match the new |
---|
12 | # release |
---|
13 | # |
---|
14 | # 2. change the value given to `fetchPypi` for `sha256` to `lib.fakeHash` |
---|
15 | # |
---|
16 | # 3. run `nix-build` |
---|
17 | # |
---|
18 | # 4. there will be an error about a hash mismatch. change the value given to |
---|
19 | # `fetchPypi` for `sha256` to the "actual" hash value report. |
---|
20 | # |
---|
21 | # 5. change the value given to `cargoDeps` for `hash` to lib.fakeHash`. |
---|
22 | # |
---|
23 | # 6. run `nix-build` |
---|
24 | # |
---|
25 | # 7. there will be an error about a hash mismatch. change the value given to |
---|
26 | # `cargoDeps` for `hash` to the "actual" hash value report. |
---|
27 | # |
---|
28 | # 8. run `nix-build`. it should succeed. if it does not, seek assistance. |
---|
29 | # |
---|
30 | { lib, fetchPypi, python, buildPythonPackage, rustPlatform }: |
---|
31 | buildPythonPackage rec { |
---|
32 | pname = "pycddl"; |
---|
33 | version = "0.6.1"; |
---|
34 | format = "pyproject"; |
---|
35 | |
---|
36 | src = fetchPypi { |
---|
37 | inherit pname version; |
---|
38 | sha256 = "sha256-63fe8UJXEH6t4l7ujV8JDvlGb7q3kL6fHHATFdklzFc="; |
---|
39 | }; |
---|
40 | |
---|
41 | # Without this, when building for PyPy, `maturin build` seems to fail to |
---|
42 | # find the interpreter at all and then fails early in the build process with |
---|
43 | # an error saying "unsupported Python interpreter". We can easily point |
---|
44 | # directly at the relevant interpreter, so do that. |
---|
45 | maturinBuildFlags = [ "--interpreter" python.executable ]; |
---|
46 | |
---|
47 | nativeBuildInputs = with rustPlatform; [ |
---|
48 | maturinBuildHook |
---|
49 | cargoSetupHook |
---|
50 | ]; |
---|
51 | |
---|
52 | cargoDeps = rustPlatform.fetchCargoTarball { |
---|
53 | inherit src; |
---|
54 | name = "${pname}-${version}"; |
---|
55 | hash = "sha256-ssDEKRd3Y9/10oXBZHCxvlRkl9KMh3pGYbCkM4rXThQ="; |
---|
56 | }; |
---|
57 | } |
---|