about summary refs log tree commit diff
path: root/pkgs/by-name/pl/plasticity/package.nix
blob: d624184c9695b3738b51e75cc8d0fedf8ece4e67 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ alsa-lib
, at-spi2-atk
, autoPatchelfHook
, cairo
, cups
, dbus
, desktop-file-utils
, expat
, fetchurl
, gdk-pixbuf
, gtk3
, gvfs
, hicolor-icon-theme
, lib
, libdrm
, libglvnd
, libnotify
, libsForQt5
, libxkbcommon
, mesa
, nspr
, nss
, openssl
, pango
, rpmextract
, stdenv
, systemd
, trash-cli
, vulkan-loader
, wrapGAppsHook
, xdg-utils
, xorg
}:
stdenv.mkDerivation rec  {
  pname = "plasticity";
  version = "1.4.19";

  src = fetchurl {
    url = "https://github.com/nkallen/plasticity/releases/download/v${version}/Plasticity-${version}-1.x86_64.rpm";
    hash = "sha256-pbq00eMabouGP33d4wbjVvw+AZ+aBWg0e3lc3ZcAwmQ=";
  };

  passthru.updateScript = ./update.sh;

  nativeBuildInputs = [ wrapGAppsHook autoPatchelfHook rpmextract mesa ];

  buildInputs = [
    alsa-lib
    at-spi2-atk
    cairo
    cups
    dbus
    desktop-file-utils
    expat
    gdk-pixbuf
    gtk3
    gvfs
    hicolor-icon-theme
    libdrm
    libnotify
    libsForQt5.kde-cli-tools
    libxkbcommon
    nspr
    nss
    openssl
    pango
    stdenv.cc.cc.lib
    trash-cli
    xdg-utils
  ];

  runtimeDependencies = [
    systemd
    libglvnd
    vulkan-loader #may help with nvidia users
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXrandr
    xorg.libXtst
  ];

  dontUnpack = true;

  # can't find anything on the internet about these files, no clue what they do
  autoPatchelfIgnoreMissingDeps = [
    "ACCAMERA.tx"
    "AcMPolygonObj15.tx"
    "ATEXT.tx"
    "ISM.tx"
    "RText.tx"
    "SCENEOE.tx"
    "TD_DbEntities.tx"
    "TD_DbIO.tx"
    "WipeOut.tx"
   ];

installPhase = ''
  runHook preInstall

  mkdir $out
  cd $out
  rpmextract $src
  mv $out/usr/* $out
  rm -r $out/usr

  runHook postInstall
'';

  #--use-gl=egl for it to use hardware rendering it seems. Otherwise there are terrible framerates
  postInstall = ''
    substituteInPlace share/applications/Plasticity.desktop \
      --replace-fail 'Exec=Plasticity %U' "Exec=Plasticity --use-gl=egl %U"
  '';

  meta = with lib; {
    description = "CAD for artists";
    homepage = "https://www.plasticity.xyz";
    license = licenses.unfree;
    mainProgram = "Plasticity";
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    maintainers = with maintainers; [ imadnyc ];
    platforms = [ "x86_64-linux" ];
  };
}