about summary refs log tree commit diff
path: root/pkgs/applications/graphics/draftsight
diff options
context:
space:
mode:
authorChris Hodapp <hodapp87@gmail.com>2017-05-01 16:14:25 -0400
committerChris Hodapp <hodapp87@gmail.com>2017-05-02 11:51:58 -0400
commit7680f83f9d586ee9b6e984de9f77a3bfefcd3b01 (patch)
tree517e821b9b6d2928925fbfb1ef446649c24941bb /pkgs/applications/graphics/draftsight
parente9b1522dd3a8ce404914794d09a96119ec40cc90 (diff)
downloadnixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar.gz
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar.bz2
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar.lz
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar.xz
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.tar.zst
nixlib-7680f83f9d586ee9b6e984de9f77a3bfefcd3b01.zip
draftsight: init at 2017-SP1
DraftSight is "a professional-grade 2D design and drafting solution
that lets you create, edit, view and markup any kind of 2D drawing."
It is available as a binary .deb package for Linux. This package jumps
through the necessary hoops to make it run properly.
Diffstat (limited to 'pkgs/applications/graphics/draftsight')
-rw-r--r--pkgs/applications/graphics/draftsight/default.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/draftsight/default.nix b/pkgs/applications/graphics/draftsight/default.nix
new file mode 100644
index 000000000000..a1cf91989ebe
--- /dev/null
+++ b/pkgs/applications/graphics/draftsight/default.nix
@@ -0,0 +1,76 @@
+{ stdenv, requireFile, dpkg, makeWrapper, gcc, mesa, xdg_utils,
+  dbus_tools, alsaLib, cups, fontconfig, glib, icu, libpng12,
+  xkeyboard_config, gstreamer, zlib, libxslt, libxml2, sqlite, orc,
+  libX11, libXcursor, libXrandr, libxcb, libXi, libSM, libICE,
+  libXrender, libXcomposite }:
+
+assert stdenv.system == "x86_64-linux";
+
+let version = "2017-SP1"; in
+stdenv.mkDerivation {
+  name = "draftsight-${version}";
+
+  nativeBuildInputs = [ dpkg makeWrapper ];
+
+  unpackPhase = ''
+    mkdir $out
+    mkdir $out/draftsight
+    dpkg -x $src $out/draftsight
+  '';
+
+  # Both executables and bundled libraries need patching to find their
+  # dependencies.  The makeWrapper & QT_XKB_CONFIG_ROOT is to
+  # alleviate "xkbcommon: ERROR: failed to add default include path
+  # /usr/share/X11/xkb" and "Qt: Failed to create XKB context!".
+  installPhase = ''
+    mkdir $out/bin
+    for exe in DraftSight dsHttpApiController dsHttpApiService FxCrashRptApp HelpGuide; do
+      echo "Patching $exe..."
+      patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+               --set-rpath $libPath:\$ORIGIN/../Libraries \
+               $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe
+      makeWrapper $out/draftsight/opt/dassault-systemes/DraftSight/Linux/$exe \
+          $out/bin/$exe \
+          --prefix "QT_XKB_CONFIG_ROOT" ":" "${xkeyboard_config}/share/X11/xkb"
+    done
+    for lib in $out/draftsight/opt/dassault-systemes/DraftSight/Libraries/*.so; do
+      # DraftSight ships with broken symlinks for some reason
+      if [ -f $(readlink -f $lib) ]
+      then
+        echo "Patching $lib..."
+        patchelf --set-rpath $libPath:\$ORIGIN/../Libraries $lib
+      else
+        echo "Ignoring broken link $lib"
+      fi
+    done
+  '';
+
+  # TODO: Figure out why HelpGuide segfaults at startup.
+
+  # This must be here for main window graphics to appear (without it
+  # it also gives the error: "QXcbIntegration: Cannot create platform
+  # OpenGL context, neither GLX nor EGL are enabled"). My guess is
+  # that it dlopen()'s libraries in paths removed by shrinking RPATH.
+  dontPatchELF = true;
+
+  src = requireFile {
+    name = "draftSight.deb";
+    url = "https://www.3ds.com/?eID=3ds_brand_download&uid=41&pidDown=13426&L=0";
+    sha256 = "0s7b74685r0961kd59hxpdp9s5yhvzx8307imsxm66f99s8rswdv";
+  };
+
+  libPath = stdenv.lib.makeLibraryPath [ gcc.cc mesa xdg_utils
+    dbus_tools alsaLib cups.lib fontconfig glib icu libpng12
+    xkeyboard_config gstreamer zlib libxslt libxml2 sqlite orc libX11
+    libXcursor libXrandr libxcb libXi libSM libICE libXrender
+    libXcomposite ];
+
+  meta = with stdenv.lib; {
+    description = "2D design & drafting application, meant to be similar to AutoCAD";
+    longDescription = "Professional-grade 2D design and drafting solution from Dassault Systèmes that lets you create, edit, view and mark up any kind of 2D CAD drawing.";
+    homepage = https://www.3ds.com/products-services/draftsight-cad-software/;
+    license = stdenv.lib.licenses.unfree;
+    maintainers = with maintainers; [ hodapp ];
+    platforms = platforms.linux;
+  };
+}