1{ stdenv, fetchurl, jre, makeDesktopItem }:
2
3let version = "4.2_2015-02-22"; in
4stdenv.mkDerivation rec {
5 name = "alloy-${version}";
6
7 src = fetchurl {
8 sha256 = "0p93v8jwx9prijpikkgmfdzb9qn8ljmvga5d9wvrkxddccjx9k28";
9 url = "http://alloy.mit.edu/alloy/downloads/alloy${version}.jar";
10 };
11
12 meta = with stdenv.lib; {
13 inherit version;
14 description = "Language & tool for relational models";
15 longDescription = ''
16 Alloy is a language for describing structures and a tool for exploring
17 them. An Alloy model is a collection of constraints that describes a set
18 of structures, e.g. all the possible security configurations of a web
19 application, or all the possible topologies of a switching network. The
20 Alloy Analyzer is a solver that takes the constraints of a model and
21 finds structures that satisfy them. Structures are displayed graphically,
22 and their appearance can be customized for the domain at hand.
23 '';
24 homepage = http://alloy.mit.edu/;
25 downloadPage = http://alloy.mit.edu/alloy/download.html;
26 license = licenses.mit;
27 platforms = with platforms; linux;
28 maintainers = with maintainers; [ nckx ];
29 };
30
31 desktopItem = makeDesktopItem rec {
32 name = "alloy";
33 exec = name;
34 icon = name;
35 desktopName = "Alloy";
36 genericName = "Relational modelling tool";
37 comment = meta.description;
38 categories = "Development;IDE;Education;";
39 };
40
41 buildInputs = [ jre ];
42
43 phases = [ "installPhase" ];
44
45 installPhase = ''
46 jar=$out/share/alloy/alloy${version}.jar
47
48 install -Dm644 ${src} $jar
49
50 cat << EOF > alloy
51 #!${stdenv.shell}
52 exec ${jre}/bin/java -jar $jar "\''${@}"
53 EOF
54
55 install -Dm755 alloy $out/bin/alloy
56
57 install -Dm644 ${./icon.png} $out/share/pixmaps/alloy.png
58 cp -r ${desktopItem}/share/applications $out/share
59 '';
60}