about summary refs log tree commit diff
path: root/pkgs/tools/misc/staruml/default.nix
blob: 036f47965b8f8a8b8e981ae979d62750cde62b39 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ stdenv, lib, fetchurl
, dpkg, wrapGAppsHook3
, hicolor-icon-theme
, gtk3, glib, systemd
, xorg, nss, nspr
, atk, at-spi2-atk, dbus
, gdk-pixbuf, pango, cairo
, expat, libdrm, mesa
, alsa-lib, at-spi2-core, cups
, libxkbcommon }:

let
  LD_LIBRARY_PATH = lib.makeLibraryPath [
    glib gtk3 xorg.libXdamage
    xorg.libX11 xorg.libxcb xorg.libXcomposite
    xorg.libXcursor xorg.libXext xorg.libXfixes
    xorg.libXi xorg.libXrender xorg.libXtst
    xorg.libxshmfence libxkbcommon nss
    nspr atk at-spi2-atk
    dbus gdk-pixbuf pango cairo
    xorg.libXrandr expat libdrm
    mesa alsa-lib at-spi2-core
    cups
  ];
in
stdenv.mkDerivation (finalAttrs: {
  version = "6.1.0";
  pname = "staruml";

  src = fetchurl {
      url = "https://files.staruml.io/releases-v6/StarUML_${finalAttrs.version}_amd64.deb";
      sha256 = "sha256-ULdrAQCiQlTN+aRhETj+ASMKkKctFgC2AfvUHGc6stU=";
    };

  nativeBuildInputs = [ wrapGAppsHook3 dpkg ];
  buildInputs = [ glib hicolor-icon-theme ];

  unpackPhase = ''
    mkdir pkg
    dpkg-deb -x $src pkg
    sourceRoot=pkg
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv opt $out

    mv usr/share $out
    rm -rf $out/share/doc

    substituteInPlace $out/share/applications/staruml.desktop \
      --replace "/opt/StarUML/staruml" "$out/bin/staruml"

    mkdir -p $out/lib
    ln -s ${stdenv.cc.cc.lib}/lib/libstdc++.so.6 $out/lib/
    ln -s ${lib.getLib systemd}/lib/libudev.so.1 $out/lib/libudev.so.0

    patchelf \
      --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      $out/opt/StarUML/staruml

    ln -s $out/opt/StarUML/staruml $out/bin/staruml
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix LD_LIBRARY_PATH ':' $out/lib:${LD_LIBRARY_PATH}
    )
  '';

  meta = with lib; {
    description = "A sophisticated software modeler";
    homepage = "https://staruml.io/";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.unfree;
    maintainers = with maintainers; [ kashw2 ];
    platforms = [ "x86_64-linux" ];
    mainProgram = "staruml";
  };
})