at 23.11-beta 150 lines 3.7 kB view raw
1{ lib, stdenv 2, makeWrapper 3, fetchurl 4, cabextract 5, gettext 6, glxinfo 7, gnupg 8, icoutils 9, imagemagick 10, netcat-gnu 11, p7zip 12, python3 13, unzip 14, wget 15, wine 16, xdg-user-dirs 17, xterm 18, pkgs 19, pkgsi686Linux 20, which 21, curl 22, jq 23, xorg 24, libGL 25, steam-run 26# needed for avoiding crash on file selector 27, gsettings-desktop-schemas 28, glib 29, wrapGAppsHook 30, hicolor-icon-theme 31}: 32 33let 34 version = "4.4"; 35 36 binpath = lib.makeBinPath [ 37 cabextract 38 python 39 gettext 40 glxinfo 41 gnupg 42 icoutils 43 imagemagick 44 netcat-gnu 45 p7zip 46 unzip 47 wget 48 wine 49 xdg-user-dirs 50 xterm 51 which 52 curl 53 jq 54 ]; 55 56 ld32 = 57 if stdenv.hostPlatform.system == "x86_64-linux" then "${stdenv.cc}/nix-support/dynamic-linker-m32" 58 else if stdenv.hostPlatform.system == "i686-linux" then "${stdenv.cc}/nix-support/dynamic-linker" 59 else throw "Unsupported platform for PlayOnLinux: ${stdenv.hostPlatform.system}"; 60 ld64 = "${stdenv.cc}/nix-support/dynamic-linker"; 61 libs = pkgs: lib.makeLibraryPath [ xorg.libX11 libGL ]; 62 63 python = python3.withPackages(ps: with ps; [ 64 wxPython_4_2 65 setuptools 66 natsort 67 ]); 68 69in stdenv.mkDerivation { 70 pname = "playonlinux"; 71 inherit version; 72 73 src = fetchurl { 74 url = "https://www.playonlinux.com/script_files/PlayOnLinux/${version}/PlayOnLinux_${version}.tar.gz"; 75 sha256 = "0n40927c8cnjackfns68zwl7h4d7dvhf7cyqdkazzwwx4k2xxvma"; 76 }; 77 78 patches = [ 79 ./0001-fix-locale.patch 80 ]; 81 82 nativeBuildInputs = [ makeWrapper wrapGAppsHook ]; 83 84 preBuild = '' 85 makeFlagsArray+=(PYTHON="python -m py_compile") 86 ''; 87 88 buildInputs = [ 89 glib 90 xorg.libX11 91 libGL 92 python 93 gsettings-desktop-schemas 94 hicolor-icon-theme 95 ]; 96 97 postPatch = '' 98 substituteAllInPlace python/lib/lng.py 99 patchShebangs python tests/python 100 sed -i "s/ %F//g" etc/PlayOnLinux.desktop 101 ''; 102 103 installPhase = '' 104 install -d $out/share/playonlinux 105 cp -r . $out/share/playonlinux/ 106 107 install -D -m644 etc/PlayOnLinux.desktop $out/share/applications/playonlinux.desktop 108 109 makeWrapper $out/share/playonlinux/playonlinux{,-wrapper} \ 110 --prefix PATH : ${binpath} \ 111 --prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/GConf 112 # steam-run is needed to run the downloaded wine executables 113 mkdir -p $out/bin 114 cat > $out/bin/playonlinux <<EOF 115 #!${stdenv.shell} -e 116 exec ${steam-run}/bin/steam-run $out/share/playonlinux/playonlinux-wrapper "\$@" 117 EOF 118 chmod a+x $out/bin/playonlinux 119 120 bunzip2 $out/share/playonlinux/bin/check_dd_x86.bz2 121 patchelf --set-interpreter $(cat ${ld32}) --set-rpath ${libs pkgsi686Linux} $out/share/playonlinux/bin/check_dd_x86 122 ${if stdenv.hostPlatform.system == "x86_64-linux" then '' 123 bunzip2 $out/share/playonlinux/bin/check_dd_amd64.bz2 124 patchelf --set-interpreter $(cat ${ld64}) --set-rpath ${libs pkgs} $out/share/playonlinux/bin/check_dd_amd64 125 '' else '' 126 rm $out/share/playonlinux/bin/check_dd_amd64.bz2 127 ''} 128 for f in $out/share/playonlinux/bin/*; do 129 bzip2 $f 130 done 131 ''; 132 133 dontWrapGApps = true; 134 postFixup = '' 135 makeWrapper $out/share/playonlinux/playonlinux{,-wrapped} \ 136 --prefix PATH : ${binpath} \ 137 ''${gappsWrapperArgs[@]} 138 makeWrapper ${steam-run}/bin/steam-run $out/bin/playonlinux \ 139 --add-flags $out/share/playonlinux/playonlinux-wrapped 140 ''; 141 142 meta = with lib; { 143 description = "GUI for managing Windows programs under linux"; 144 homepage = "https://www.playonlinux.com/"; 145 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 146 license = licenses.gpl3; 147 maintainers = [ maintainers.pasqui23 ]; 148 platforms = [ "x86_64-linux" "i686-linux" ]; 149 }; 150}