about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/ugs/default.nix
blob: 2a3eea73c07f8edf89e2fd3d93ed9e4de15be331 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ stdenv
, lib
, copyDesktopItems
, makeDesktopItem
, makeWrapper
, jre
, fetchzip
}:
let
  desktopItem = makeDesktopItem {
    name = "ugs";
    exec = "ugs";
    comment = "A cross-platform G-Code sender for GRBL, Smoothieware, TinyG and G2core.";
    desktopName = "Universal-G-Code-Sender";
    categories = [ "Game" ];
  };

in
stdenv.mkDerivation rec {
  pname = "ugs";
  version = "2.1.6";

  src = fetchzip {
    url = "https://github.com/winder/Universal-G-Code-Sender/releases/download/v${version}/UniversalGcodeSender.zip";
    hash = "sha256-6L/4s/QmlTnYnhwLgPf7z8UVkBUYXi3Wb3doa5JCViE=";
  };

  dontUnpack = true;

  nativeBuildInputs = [ copyDesktopItems makeWrapper ];

  installPhase = ''
    runHook preInstall

    makeWrapper ${jre}/bin/java $out/bin/ugs \
      --prefix PATH : ${lib.makeBinPath [ jre ]} \
      --add-flags "-jar ${src}/UniversalGcodeSender.jar"

    runHook postInstall
  '';

  desktopItems = [ desktopItem ];

  meta = with lib; {
    description = "A cross-platform G-Code sender for GRBL, Smoothieware, TinyG and G2core";
    homepage = "https://github.com/winder/Universal-G-Code-Sender";
    maintainers = with maintainers; [ matthewcroughan ];
    sourceProvenance = with sourceTypes; [ binaryBytecode ];
    license = licenses.gpl3;
    platforms = platforms.all;
    mainProgram = "ugs";
  };
}