1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, sdcc
5, nmigen
6, fx2
7, libusb1
8, aiohttp
9, pyvcd
10, bitarray
11, crcmod
12, yosys
13, icestorm
14, nextpnr
15}:
16
17buildPythonPackage rec {
18 pname = "glasgow";
19 version = "unstable-2019-08-31";
20 realVersion = lib.substring 0 7 src.rev;
21
22 src = fetchFromGitHub {
23 owner = "GlasgowEmbedded";
24 repo = "Glasgow";
25 rev = "21641a13c6a0daaf8618aff3c5bfffcb26ef6cca";
26 sha256 = "1dpm1jmm4fg8xf17s6h9g5sc09gq8b6xq955sv2x11nrbqf98l4v";
27 };
28
29 nativeBuildInputs = [ sdcc ];
30
31 propagatedBuildInputs = [
32 nmigen
33 fx2
34 libusb1
35 aiohttp
36 pyvcd
37 bitarray
38 crcmod
39 ];
40
41 postPatch = ''
42 substituteInPlace software/setup.py \
43 --replace 'versioneer.get_version()' '"${realVersion}"'
44 '';
45
46 preBuild = ''
47 make -C firmware LIBFX2=${fx2}/share/libfx2
48 cp firmware/glasgow.ihex software/glasgow
49 cd software
50 '';
51
52 # a couple failing tests and also installCheck tries to build_ext again
53 doInstallCheck = false;
54 doCheck = false;
55
56 checkPhase = ''
57 python -m unittest discover
58 '';
59
60 meta = with lib; {
61 description = "Software for Glasgow, a digital interface multitool";
62 homepage = https://github.com/GlasgowEmbedded/Glasgow;
63 license = licenses.bsd0;
64 maintainers = with maintainers; [ emily ];
65 };
66}