aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/misc/staruml/default.nix
blob: d0266cf30e28700ffbd6bfea2a2fd676ec460e46 (plain)
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
{ stdenv, lib, fetchurl, makeWrapper
, dpkg, patchelf
, gtk2, glib, gdk-pixbuf, alsaLib, nss, nspr, GConf, cups, libgcrypt, dbus, systemd
, libXdamage, expat }:

let
  inherit (stdenv) lib;
  LD_LIBRARY_PATH = lib.makeLibraryPath
    [ glib gtk2 gdk-pixbuf alsaLib nss nspr GConf cups libgcrypt dbus libXdamage expat ];
in
stdenv.mkDerivation rec {
  version = "2.8.1";
  pname = "staruml";

  src =
    if stdenv.hostPlatform.system == "i686-linux" then fetchurl {
      url = "https://s3.amazonaws.com/staruml-bucket/releases-v2/StarUML-v${version}-32-bit.deb";
      sha256 = "0vb3k9m3l6pmsid4shlk0xdjsriq3gxzm8q7l04didsppg0vvq1n";
    } else fetchurl {
      url = "https://s3.amazonaws.com/staruml-bucket/releases-v2/StarUML-v${version}-64-bit.deb";
      sha256 = "05gzrnlssjkhyh0wv019d4r7p40lxnsa1sghazll6f233yrqmxb0";
    };

  nativeBuildInputs = [ makeWrapper dpkg ];

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

  installPhase = ''
    mkdir $out
    mv opt/staruml $out/bin

    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

    for binary in StarUML Brackets-node; do
      ${patchelf}/bin/patchelf \
        --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        $out/bin/$binary
      wrapProgram $out/bin/$binary \
        --prefix LD_LIBRARY_PATH : $out/lib:${LD_LIBRARY_PATH}
    done
  '';

  meta = with stdenv.lib; {
    description = "A sophisticated software modeler";
    homepage = "https://staruml.io/";
    license = licenses.unfree;
    platforms = [ "i686-linux" "x86_64-linux" ];
  };
}