dput-ng: fix eval (#364540)
[NixPkgs.git] / pkgs / by-name / di / diylc / package.nix
blob14a2949fb3aef6d7ce46f8074d48d2fc45db2f26
2   lib,
3   stdenv,
4   fetchurl,
5   makeDesktopItem,
6   unzip,
7   bash,
8   jre8,
9 }:
11 let
12   pname = "diylc";
13   version = "4.18.0";
14   files = {
15     app = fetchurl {
16       url = "https://github.com/bancika/diy-layout-creator/releases/download/v${version}/diylc-${version}.zip";
17       sha256 = "09fpp3dn086clgnjz5yj4fh5bnjvj6mvxkx9n3zamcwszjmxr40d";
18     };
19     icon16 = fetchurl {
20       url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_small.png";
21       sha256 = "1is50aidfwzwfzwqv57s2hwhx0r5c21cp77bkl93xkdqkh2wd8x4";
22     };
23     icon32 = fetchurl {
24       url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_medium.png";
25       sha256 = "0a45p18n84xz1nd3zv3y16jlimvqzhbzg3q3f4lawgx4rcrn2n3d";
26     };
27     icon48 = fetchurl {
28       url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_large.png";
29       sha256 = "06dkz0dcy8hfmnzr5ri5n1sh8r7mg83kzbvs3zy58wwhgzs1ddk6";
30     };
31   };
32   launcher = makeDesktopItem {
33     name = "diylc";
34     desktopName = "DIY Layout Creator";
35     comment = "Multi platform circuit layout and schematic drawing tool";
36     exec = "diylc";
37     icon = "diylc_icon";
38     categories = [
39       "Development"
40       "Electronics"
41     ];
42   };
44 stdenv.mkDerivation rec {
45   inherit pname version;
47   dontUnpack = true;
49   buildInputs = [ jre8 ];
50   nativeBuildInputs = [ unzip ];
52   installPhase = ''
53     runHook preInstall
55     mkdir -p $out/share/diylc
56     unzip -UU ${files.app} -d $out/share/diylc
57     rm $out/share/diylc/diylc.exe
58     rm $out/share/diylc/run.sh
60     # Nope, the icon cannot be named 'diylc' because KDE does not like it.
61     install -Dm644 ${files.icon16} $out/share/icons/hicolor/16x16/apps/diylc_icon.png
62     install -Dm644 ${files.icon32} $out/share/icons/hicolor/32x32/apps/diylc_icon.png
63     install -Dm644 ${files.icon48} $out/share/icons/hicolor/48x48/apps/diylc_icon.png
65     mkdir -p $out/share/applications
66     ln -s ${launcher}/share/applications/* $out/share/applications/
68     mkdir -p $out/bin
69     cat <<EOF > $out/bin/diylc
70     #!${bash}/bin/sh
71     cd $out/share/diylc
72     ${jre8}/bin/java -Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8 -cp diylc.jar:lib org.diylc.DIYLCStarter
73     EOF
74     chmod +x $out/bin/diylc
76     runHook postInstall
77   '';
79   meta = with lib; {
80     description = "Multi platform circuit layout and schematic drawing tool";
81     mainProgram = "diylc";
82     homepage = "https://bancika.github.io/diy-layout-creator/";
83     changelog = "https://github.com/bancika/diy-layout-creator/releases";
84     license = licenses.gpl3Plus;
85     sourceProvenance = with sourceTypes; [ binaryBytecode ];
86     platforms = platforms.linux;
87     maintainers = [ ];
88   };