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