about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/electronics/diylc/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/diylc/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix b/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix
new file mode 100644
index 000000000000..70d07460a751
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/diylc/default.nix
@@ -0,0 +1,71 @@
+{ lib, stdenv, fetchurl, makeDesktopItem, unzip, bash, jre8 }:
+
+let
+  pname = "diylc";
+  version = "4.15.1";
+  files = {
+    app = fetchurl {
+      url = "https://github.com/bancika/diy-layout-creator/releases/download/v${version}/diylc-${version}.zip";
+      sha256 = "09vzbxas654n8npxljqljf930y5gcjfvv3r4dv97dwk5sy66xvaf";
+    };
+    icon16 = fetchurl {
+      url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_small.png";
+      sha256 = "1is50aidfwzwfzwqv57s2hwhx0r5c21cp77bkl93xkdqkh2wd8x4";
+    };
+    icon32 = fetchurl {
+      url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_medium.png";
+      sha256 = "0a45p18n84xz1nd3zv3y16jlimvqzhbzg3q3f4lawgx4rcrn2n3d";
+    };
+    icon48 = fetchurl {
+      url = "https://raw.githubusercontent.com/bancika/diy-layout-creator/v${version}/diylc/diylc-core/src/org/diylc/core/images/icon_large.png";
+      sha256 = "06dkz0dcy8hfmnzr5ri5n1sh8r7mg83kzbvs3zy58wwhgzs1ddk6";
+    };
+  };
+  launcher = makeDesktopItem {
+    name = "diylc";
+    desktopName = "DIY Layout Creator";
+    comment = "Multi platform circuit layout and schematic drawing tool";
+    exec = "diylc";
+    icon = "diylc_icon";
+    categories = "Development;Electronics;";
+  };
+in
+stdenv.mkDerivation rec {
+  inherit pname version;
+
+  dontUnpack = true;
+
+  buildInputs = [ jre8 ];
+  nativeBuildInputs = [ unzip ];
+
+  installPhase = ''
+    install -d $out/share/diylc
+    ${unzip}/bin/unzip -UU ${files.app} -d $out/share/diylc
+    rm $out/share/diylc/diylc.exe
+    rm $out/share/diylc/run.sh
+
+    # Nope, the icon cannot be named 'diylc' because KDE does not like it.
+    install -Dm644 ${files.icon16} $out/share/icons/hicolor/16x16/apps/diylc_icon.png
+    install -Dm644 ${files.icon32} $out/share/icons/hicolor/32x32/apps/diylc_icon.png
+    install -Dm644 ${files.icon48} $out/share/icons/hicolor/48x48/apps/diylc_icon.png
+
+    install -d $out/share/applications
+    ln -s ${launcher}/share/applications/* $out/share/applications/
+
+    install -d $out/bin
+    cat <<EOF > $out/bin/diylc
+    #!${bash}/bin/sh
+    cd $out/share/diylc
+    ${jre8}/bin/java -Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8 -cp diylc.jar:lib org.diylc.DIYLCStarter
+    EOF
+    chmod +x $out/bin/diylc
+  '';
+
+  meta = with lib; {
+    description = "Multi platform circuit layout and schematic drawing tool";
+    homepage = "https://bancika.github.io/diy-layout-creator/";
+    changelog = "https://github.com/bancika/diy-layout-creator/releases";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}