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