1{ stdenv, lib, fetchurl, makeWrapper, yacc, gcc
2, withISpin ? true, tk, swarm, graphviz }:
3
4let
5 binPath = stdenv.lib.makeBinPath [ gcc ];
6 ibinPath = stdenv.lib.makeBinPath [ gcc tk swarm graphviz tk ];
7
8in stdenv.mkDerivation rec {
9 name = "spin-${version}";
10 version = "6.4.6";
11 url-version = stdenv.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 url = "https://www.dropbox.com/sh/fgzipzp4wpo3qc1/AAA-vBeJ7xty-CDZgk7OB58Ta/spin646.tar.gz?raw=1";
18 sha256 = "1n33qzlb7g30vhr5yxssw210b2m0242y9j21c7fqpn9z6b0rbhjp";
19 };
20
21 nativeBuildInputs = [ makeWrapper ];
22 buildInputs = [ yacc ];
23
24 sourceRoot = "Spin/Src${version}";
25
26 installPhase = ''
27 install -Dm755 spin $out/bin/spin
28 wrapProgram $out/bin/spin \
29 --prefix PATH : ${binPath}
30 '' + lib.optionalString withISpin ''
31 install -Dm755 ../iSpin/ispin.tcl $out/bin/ispin
32 wrapProgram $out/bin/ispin \
33 --prefix PATH ':' "$out/bin:${ibinPath}"
34 '';
35
36 meta = with stdenv.lib; {
37 description = "Formal verification tool for distributed software systems";
38 homepage = http://spinroot.com/;
39 license = licenses.free;
40 platforms = platforms.linux;
41 maintainers = with maintainers; [ mornfall pSub ];
42 };
43}