nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 177 lines 4.5 kB view raw
1{ 2 alsa-lib, 3 autoPatchelfHook, 4 buildFHSEnv, 5 elfutils, 6 extraEnv ? { }, 7 fetchurl, 8 ffmpeg_6-headless, 9 lib, 10 libdrm, 11 libgbm, 12 libpulseaudio, 13 libva, 14 libxkbcommon, 15 libxml2_13, 16 makeShellWrapper, 17 minizip, 18 nss, 19 squashfsTools, 20 stdenv, 21 writeShellScript, 22 xkeyboard_config, 23 libxcb-wm, 24 libxcb-render-util, 25 libxcb-keysyms, 26 libxcb-image, 27 libxtst, 28 libxrender, 29 libxrandr, 30 libxinerama, 31 libxdamage, 32 libxcomposite, 33 xrandr, 34 libxshmfence, 35}: 36let 37 pname = "plex-htpc"; 38 version = "1.71.1"; 39 rev = "73"; 40 meta = { 41 homepage = "https://plex.tv/"; 42 description = "Plex HTPC client for the big screen"; 43 longDescription = '' 44 Plex HTPC for Linux is your client for playing on your Linux computer 45 connected to the big screen. It features a 10-foot interface with a 46 powerful playback engine. 47 ''; 48 maintainers = with lib.maintainers; [ detroyejr ]; 49 license = lib.licenses.unfree; 50 platforms = [ "x86_64-linux" ]; 51 mainProgram = "plex-htpc"; 52 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 53 }; 54 plex-htpc = stdenv.mkDerivation { 55 inherit pname version meta; 56 57 src = fetchurl { 58 url = "https://api.snapcraft.io/api/v1/snaps/download/81OP06hEXlwmMrpMAhe5hyLy5bQ9q6Kz_${rev}.snap"; 59 hash = "sha512-n9pXRx8s6AwhIJm7PmUIOB8pXqzyNFzdmwJMonQ4WzWvA5tPI27x0slQ6WUxRBQJoLScGckyGAFxIGWRylNr3g=="; 60 }; 61 62 nativeBuildInputs = [ 63 autoPatchelfHook 64 makeShellWrapper 65 squashfsTools 66 ]; 67 68 buildInputs = [ 69 elfutils 70 ffmpeg_6-headless 71 libgbm 72 libpulseaudio 73 libva 74 libxkbcommon 75 libxml2_13 76 minizip 77 nss 78 stdenv.cc.cc 79 libxcomposite 80 libxdamage 81 libxinerama 82 libxrandr 83 libxrender 84 libxtst 85 libxshmfence 86 libxcb-image 87 libxcb-keysyms 88 libxcb-render-util 89 libxcb-wm 90 xrandr 91 ]; 92 93 strictDeps = true; 94 95 unpackPhase = '' 96 runHook preUnpack 97 unsquashfs "$src" 98 cd squashfs-root 99 runHook postUnpack 100 ''; 101 102 dontStrip = true; 103 dontWrapQtApps = true; 104 105 installPhase = '' 106 runHook preInstall 107 108 cp -r . $out 109 rm -r $out/etc 110 rm -r $out/usr 111 112 # flatpak removes these during installation. 113 rm -r $out/lib/dri 114 rm $out/lib/libpciaccess.so* 115 rm $out/lib/libswresample.so* 116 rm $out/lib/libva-*.so* 117 rm $out/lib/libva.so* 118 rm $out/lib/libEGL.so* 119 rm $out/lib/libdrm.so* 120 rm $out/lib/libdrm* 121 122 # Keep some dependencies from the snap. 123 cp usr/lib/x86_64-linux-gnu/liblcms2.so.2 $out/lib/liblcms2.so.2 124 cp usr/lib/x86_64-linux-gnu/libjbig.so.0 $out/lib/libjbig.so.0 125 cp usr/lib/x86_64-linux-gnu/libjpeg.so.8 $out/lib/libjpeg.so.8 126 cp usr/lib/x86_64-linux-gnu/libpci.so.3 $out/lib/libpci.so.3 127 cp usr/lib/x86_64-linux-gnu/libsnappy.so.1 $out/lib/libsnappy.so.1 128 cp usr/lib/x86_64-linux-gnu/libtiff.so.5 $out/lib/libtiff.so.5 129 cp usr/lib/x86_64-linux-gnu/libwebp.so.6 $out/lib/libwebp.so.6 130 cp usr/lib/x86_64-linux-gnu/libxkbfile.so.1 $out/lib/libxkbfile.so.1 131 cp usr/lib/x86_64-linux-gnu/libxslt.so.1 $out/lib/libxslt.so.1 132 133 runHook postInstall 134 ''; 135 }; 136in 137buildFHSEnv { 138 inherit pname version meta; 139 targetPkgs = pkgs: [ 140 alsa-lib 141 libdrm 142 xkeyboard_config 143 ]; 144 145 extraInstallCommands = '' 146 mkdir -p $out/share/applications $out/share/icons/hicolor/scalable/apps 147 install -m 444 -D ${plex-htpc}/meta/gui/plex-htpc.desktop $out/share/applications/plex-htpc.desktop 148 substituteInPlace $out/share/applications/plex-htpc.desktop \ 149 --replace-fail \ 150 'Icon=''${SNAP}/meta/gui/icon.png' \ 151 'Icon=${plex-htpc}/meta/gui/icon.png' 152 ''; 153 154 runScript = writeShellScript "plex-htpc.sh" '' 155 # Widevine won't download unless this directory exists. 156 mkdir -p $HOME/.cache/plex/ 157 158 # Copy the sqlite plugin database on first run. 159 PLEX_DB="$HOME/.local/share/plex/Plex Media Server/Plug-in Support/Databases" 160 if [[ ! -d "$PLEX_DB" ]]; then 161 mkdir -p "$PLEX_DB" 162 cp "${plex-htpc}/resources/com.plexapp.plugins.library.db" "$PLEX_DB" 163 fi 164 165 # db files should have write access. 166 chmod --recursive 750 "$PLEX_DB" 167 168 # These environment variables sometimes silently cause plex to crash. 169 unset QT_QPA_PLATFORM QT_STYLE_OVERRIDE 170 171 set -o allexport 172 ${lib.toShellVars extraEnv} 173 set +o allexport 174 exec ${plex-htpc}/Plex.sh 175 ''; 176 passthru.updateScript = ./update.sh; 177}