1{ stdenv, lib, fetchurl, makeWrapper, bison, gcc
2, withISpin ? true, tk, swarm, graphviz }:
3
4let
5 binPath = lib.makeBinPath [ gcc ];
6 ibinPath = lib.makeBinPath [ gcc tk swarm graphviz tk ];
7
8in stdenv.mkDerivation rec {
9 pname = "spin";
10 version = "6.4.9";
11 url-version = lib.replaceChars ["."] [""] version;
12
13 src = fetchurl {
14 # The homepage is behind CloudFlare anti-DDoS protection, which blocks cURL.
15 # Dropbox mirror from developers:
16 # https://www.dropbox.com/sh/fgzipzp4wpo3qc1/AADZPqS4aoR-pjNF6OQXRLQHa
17 # (note that this URL doesn't work aross versions and hash should come from official site)
18 url = "https://www.dropbox.com/sh/fgzipzp4wpo3qc1/AABtxFePMJmPxsxSvU5cpxh8a/spin${url-version}.tar.gz?raw=1";
19 sha256 = "07b7wk3qyfnp4pgwicqd33l7i1krzyihx0cf9zkv81ywaklf5vll";
20 };
21
22 nativeBuildInputs = [ makeWrapper ];
23 buildInputs = [ bison ];
24
25 sourceRoot = "Spin/Src${version}";
26
27 installPhase = ''
28 install -Dm644 ../Man/spin.1 $out/share/man/man1/spin.1
29
30 install -Dm755 spin $out/bin/spin
31 wrapProgram $out/bin/spin \
32 --prefix PATH : ${binPath}
33 '' + lib.optionalString withISpin ''
34 install -Dm755 ../iSpin/ispin.tcl $out/bin/ispin
35 wrapProgram $out/bin/ispin \
36 --prefix PATH ':' "$out/bin:${ibinPath}"
37 '';
38
39 meta = with lib; {
40 description = "Formal verification tool for distributed software systems";
41 homepage = "https://spinroot.com/";
42 license = licenses.free;
43 platforms = platforms.linux ++ platforms.darwin;
44 maintainers = with maintainers; [ pSub ];
45 };
46}