nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 ant,
7 jdk8,
8 makeWrapper,
9 makeDesktopItem,
10 copyDesktopItems,
11 strip-nondeterminism,
12 stripJavaArchivesHook,
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "brmodelo";
17 version = "3.31";
18
19 src = fetchFromGitHub {
20 owner = "chcandido";
21 repo = "brmodelo";
22 rev = finalAttrs.version;
23 hash = "sha256-YJcGfrcB+Qw35bMnqVs/tBzMGVj2DmfhRZ0YsSGGGSc=";
24 };
25
26 nativeBuildInputs = [
27 ant
28 jdk8
29 makeWrapper
30 copyDesktopItems
31 strip-nondeterminism
32 stripJavaArchivesHook
33 ];
34
35 patches = [
36 # Fixes for building with Ant.
37 # https://github.com/chcandido/brModelo/pull/22
38 (fetchpatch {
39 name = "fix-self-closing-element-not-allowed.patch";
40 url = "https://github.com/yuuyins/brModelo/commit/0d712b74fd5d29d67be07480ed196da28a77893b.patch";
41 hash = "sha256-yy03arE6xetotzyvpToi9o9crg3KnMRn1J70jDUvSXE=";
42 })
43 (fetchpatch {
44 name = "fix-tag-closing.patch";
45 url = "https://github.com/yuuyins/brModelo/commit/e8530ff75f024cf6effe0408ed69985405e9709c.patch";
46 hash = "sha256-MNuh/ORbaAkB5qDSlA/nPrXN+tqzz4oOglVyEtSangI=";
47 })
48 (fetchpatch {
49 name = "fix-bad-use-greater-than.patch";
50 url = "https://github.com/yuuyins/brModelo/commit/498a6ef8129daff5a472b318f93c8f7f2897fc7f.patch";
51 hash = "sha256-MmAwYUmx38DGRsiSxCWCObtpqxk0ykUQiDSC76bCpFc=";
52 })
53 (fetchpatch {
54 name = "fix-param-errors.patch";
55 url = "https://github.com/yuuyins/brModelo/commit/8a508aaba0bcffe13a3f95cff495230beea36bc4.patch";
56 hash = "sha256-qME9gZChSMzu1vs9HaosD+snb+jlOrQLY97meNoA8oU=";
57 })
58
59 # Add SVG icons.
60 # https://github.com/chcandido/brModelo/pull/23
61 (fetchpatch {
62 name = "add-brmodelo-logo-icons-svg.patch";
63 url = "https://github.com/yuuyins/brModelo/commit/f260b82b664fad3325bbf3ebd7a15488d496946b.patch";
64 hash = "sha256-UhgcWxsHkNFS1GgaRnmlZohjDR8JwHof2cIb3SBetYs=";
65 })
66 ];
67
68 buildPhase = ''
69 runHook postBuild
70 ant
71 runHook preBuild
72 '';
73
74 desktopItems = [
75 (makeDesktopItem {
76 name = "brmodelo";
77 desktopName = "brModelo";
78 genericName = "Entity-relationship diagramming tool";
79 exec = "brmodelo";
80 icon = "brmodelo";
81 comment = finalAttrs.meta.description;
82 categories = [
83 "Development"
84 "Education"
85 "Database"
86 "2DGraphics"
87 "ComputerScience"
88 "DataVisualization"
89 "Engineering"
90 "Java"
91 ];
92 })
93 ];
94
95 installPhase = ''
96 runHook preInstall
97
98 mkdir -p $out/share/doc/brmodelo
99 cp -rv ./dist/javadoc $out/share/doc/brmodelo/
100
101 install -Dm755 ./dist/brModelo.jar -t $out/share/java/
102 # NOTE: The standard Java GUI toolkit has a
103 # hard-coded list of "non-reparenting" window managers,
104 # which cause issues while running brModelo
105 # in WMs that are not in that list (e.g. XMonad).
106 # Solution/Workaround: set the environment variable
107 # _JAVA_AWT_WM_NONREPARENTING=1.
108 makeWrapper ${jdk8}/bin/java $out/bin/brmodelo \
109 --prefix _JAVA_AWT_WM_NONREPARENTING : 1 \
110 --prefix _JAVA_OPTIONS " " "-Dawt.useSystemAAFontSettings=gasp" \
111 --add-flags "-jar $out/share/java/brModelo.jar"
112
113 for size in 16 24 32 48 64 128 256; do
114 install -Dm644 ./src/imagens/icone_"$size"x"$size".svg \
115 $out/share/icons/hicolor/"$size"x"$size"/apps/brmodelo.svg
116 done
117
118 runHook postInstall
119 '';
120
121 preFixup = ''
122 find $out/share/doc/brmodelo/javadoc -name "*.html" -exec strip-nondeterminism --type javadoc {} +
123 '';
124
125 meta = with lib; {
126 description = "Entity-relationship diagram tool for making conceptual and logical database models";
127 homepage = "https://github.com/chcandido/brModelo";
128 license = licenses.gpl3;
129 mainProgram = "brmodelo";
130 maintainers = with maintainers; [ yuu ];
131 };
132})