1{ lib, stdenv, fetchurl, jre, makeWrapper, makeDesktopItem }:
2
3let generic = { major, version, src }:
4
5 stdenv.mkDerivation rec {
6 name = "${nameMajor}-${version}";
7 nameMajor = "alloy${major}";
8
9 desktopItem = makeDesktopItem rec {
10 name = nameMajor;
11 exec = name;
12 icon = name;
13 desktopName = "Alloy ${major}";
14 genericName = "Relational modelling tool";
15 comment = meta.description;
16 categories = "Development;IDE;Education;";
17 };
18
19 nativeBuildInputs = [ makeWrapper ];
20
21 buildCommand = ''
22 jar=$out/share/alloy/${nameMajor}.jar
23 install -Dm644 ${src} $jar
24
25 mkdir -p $out/bin
26 makeWrapper ${jre}/bin/java $out/bin/${nameMajor} --add-flags \
27 "-jar $jar"
28
29 install -Dm644 ${./icon.png} $out/share/pixmaps/${nameMajor}.png
30 cp -r ${desktopItem}/share/applications $out/share
31 '';
32
33 meta = with lib; {
34 description = "Language & tool for relational models";
35 longDescription = ''
36 Alloy is a language for describing structures and a tool for exploring
37 them. An Alloy model is a collection of constraints that describes a set
38 of structures, e.g. all the possible security configurations of a web
39 application, or all the possible topologies of a switching network. The
40 Alloy Analyzer is a solver that takes the constraints of a model and
41 finds structures that satisfy them. Structures are displayed graphically,
42 and their appearance can be customized for the domain at hand.
43 '';
44 homepage = "http://alloytools.org/";
45 downloadPage = "http://alloytools.org/download.html";
46 license = licenses.mit;
47 platforms = platforms.unix;
48 maintainers = with maintainers; [ notbandali ];
49 };
50 };
51
52in rec {
53 alloy4 = let version = "4.2_2015-02-22"; in generic {
54 major = "4";
55 inherit version;
56 src = fetchurl {
57 sha256 = "0p93v8jwx9prijpikkgmfdzb9qn8ljmvga5d9wvrkxddccjx9k28";
58 url = "http://alloytools.org/download/alloy${version}.jar";
59 };
60 };
61
62 alloy5 = let version = "5.1.0"; in generic {
63 major = "5";
64 inherit version;
65 src = fetchurl {
66 sha256 = "02k9khs4k5nc86x9pp5k3vcb0kiwdgcin46mlap4fycnr673xd53";
67 url = "https://github.com/AlloyTools/org.alloytools.alloy/releases/download/v${version}/org.alloytools.alloy.dist.jar";
68 };
69 };
70
71 alloy = alloy5;
72}