2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, file, fetchurl, makeWrapper,
|
2020-04-24 23:36:52 +00:00
|
|
|
autoPatchelfHook, jsoncpp, libpulseaudio }:
|
|
|
|
let
|
2021-02-05 17:12:51 +00:00
|
|
|
versionMajor = "7.0";
|
|
|
|
versionMinor = "211";
|
|
|
|
versionBuild_x86_64 = "4";
|
|
|
|
versionBuild_i686 = "4";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nomachine-client";
|
|
|
|
version = "${versionMajor}.${versionMinor}";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src =
|
|
|
|
if stdenv.hostPlatform.system == "x86_64-linux" then
|
|
|
|
fetchurl {
|
2021-02-05 17:12:51 +00:00
|
|
|
url = "https://download.nomachine.com/download/${versionMajor}/Linux/nomachine_${version}_${versionBuild_x86_64}_x86_64.tar.gz";
|
|
|
|
sha256 = "06habqsl5gp13sym519r3qp188qwqqfw8p48wcs4zj3kcri6fjz0";
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|
|
|
|
else if stdenv.hostPlatform.system == "i686-linux" then
|
|
|
|
fetchurl {
|
2021-02-05 17:12:51 +00:00
|
|
|
url = "https://download.nomachine.com/download/${versionMajor}/Linux/nomachine_${version}_${versionBuild_i686}_i686.tar.gz";
|
|
|
|
sha256 = "1y4lr95mwilwr7gqsxqvygq4w3dcp4cjh8m06wdi3avwdzrjkgj9";
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
throw "NoMachine client is not supported on ${stdenv.hostPlatform.system}";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# nxusb-legacy is only needed for kernel versions < 3
|
2020-04-24 23:36:52 +00:00
|
|
|
postUnpack = ''
|
|
|
|
mv $(find . -type f -name nxclient.tar.gz) .
|
|
|
|
mv $(find . -type f -name nxplayer.tar.gz) .
|
|
|
|
rm -r NX/
|
|
|
|
tar xf nxclient.tar.gz
|
|
|
|
tar xf nxplayer.tar.gz
|
|
|
|
rm $(find . -maxdepth 1 -type f)
|
2021-02-05 17:12:51 +00:00
|
|
|
rm -r NX/share/src/nxusb-legacy
|
|
|
|
rm NX/bin/nxusbd-legacy NX/lib/libnxusb-legacy.so
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ file makeWrapper autoPatchelfHook ];
|
|
|
|
buildInputs = [ jsoncpp libpulseaudio ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
rm bin/nxplayer bin/nxclient
|
|
|
|
|
|
|
|
mkdir -p $out/NX
|
|
|
|
cp -r bin lib share $out/NX/
|
|
|
|
|
|
|
|
ln -s $out/NX/bin $out/bin
|
|
|
|
|
|
|
|
for i in share/icons/*; do
|
|
|
|
if [[ -d "$i" ]]; then
|
|
|
|
mkdir -p "$out/share/icons/hicolor/$(basename $i)/apps"
|
|
|
|
cp "$i"/* "$out/share/icons/hicolor/$(basename $i)/apps/"
|
|
|
|
fi
|
|
|
|
done
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir $out/share/applications
|
|
|
|
cp share/applnk/player/xdg/*.desktop $out/share/applications/
|
|
|
|
cp share/applnk/client/xdg-mime/*.desktop $out/share/applications/
|
|
|
|
|
|
|
|
mkdir -p $out/share/mime/packages
|
|
|
|
cp share/applnk/client/xdg-mime/*.xml $out/share/mime/packages/
|
|
|
|
|
|
|
|
for i in $out/share/applications/*.desktop; do
|
|
|
|
substituteInPlace "$i" --replace /usr/NX/bin $out/bin
|
|
|
|
done
|
|
|
|
'';
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = ''
|
|
|
|
makeWrapper $out/bin/nxplayer.bin $out/bin/nxplayer --set NX_SYSTEM $out/NX
|
|
|
|
makeWrapper $out/bin/nxclient.bin $out/bin/nxclient --set NX_SYSTEM $out/NX
|
|
|
|
|
|
|
|
# libnxcau.so needs libpulse.so.0 for audio to work, but doesn't
|
|
|
|
# have a DT_NEEDED entry for it.
|
|
|
|
patchelf --add-needed libpulse.so.0 $out/NX/lib/libnxcau.so
|
|
|
|
'';
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
dontBuild = true;
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "NoMachine remote desktop client (nxplayer)";
|
|
|
|
homepage = "https://www.nomachine.com/";
|
|
|
|
license = {
|
2021-02-05 17:12:51 +00:00
|
|
|
fullName = "NoMachine 7 End-User License Agreement";
|
|
|
|
url = "https://www.nomachine.com/licensing-7";
|
2020-04-24 23:36:52 +00:00
|
|
|
free = false;
|
|
|
|
};
|
|
|
|
maintainers = with maintainers; [ talyz ];
|
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
|
|
|
};
|
|
|
|
}
|
2020-05-15 21:57:56 +00:00
|
|
|
|