Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created May 1, 2017 20:27
Show Gist options
  • Save cleverca22/3ad111fa77b17854e1fcca25bfd13544 to your computer and use it in GitHub Desktop.
Save cleverca22/3ad111fa77b17854e1fcca25bfd13544 to your computer and use it in GitHub Desktop.
{ stdenv, requireFile, dpkg, 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 = "tmp"; in
stdenv.mkDerivation {
name = "draftsight-${version}";
nativeBuildInputs = [ dpkg ];
unpackPhase = ''
mkdir $out/draftsight
dpkg -x $src $out/draftsight
'';
installPhase = ''
patchelf --print-rpath $out/draftsight/opt/dassault-systemes/DraftSight/Linux/DraftSight
echo "readelf:"
readelf -d $out/draftsight/opt/dassault-systemes/DraftSight/Linux/DraftSight
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath $libPath:\$ORIGIN/../Libraries $out/draftsight/opt/dassault-systemes/DraftSight/Linux/DraftSight
echo "New rpath:"
patchelf --print-rpath $out/draftsight/opt/dassault-systemes/DraftSight/Linux/DraftSight
mkdir $out/bin
ln -s $out/draftsight/opt/dassault-systemes/DraftSight/Linux/DraftSight $out/bin/DraftSight
'';
src = requireFile {
name = "draftSight.deb";
url = "n/a";
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 = {
description = "";
homepage = https://www.3ds.com/products-services/draftsight-cad-software/;
license = stdenv.lib.licenses.unfree;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment