From dab7fc979de1f20d59fa03cba9d80df1af8a8c1e Mon Sep 17 00:00:00 2001 From: detroyejr Date: Tue, 1 Oct 2024 14:04:23 -0400 Subject: [PATCH 1/2] plex-desktop: format with nixfmt --- pkgs/by-name/pl/plex-desktop/package.nix | 134 ++++++++++++----------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/pkgs/by-name/pl/plex-desktop/package.nix b/pkgs/by-name/pl/plex-desktop/package.nix index a52794e81eea4..fe5949f22cb1e 100644 --- a/pkgs/by-name/pl/plex-desktop/package.nix +++ b/pkgs/by-name/pl/plex-desktop/package.nix @@ -1,34 +1,35 @@ -{ alsa-lib -, autoPatchelfHook -, buildFHSEnv -, dbus -, elfutils -, expat -, extraEnv ? { } -, fetchFromGitLab -, fetchurl -, glib -, glibc -, lib -, libGL -, libapparmor -, libbsd -, libedit -, libffi_3_3 -, libgcrypt -, libglvnd -, makeShellWrapper -, sqlite -, squashfsTools -, stdenv -, tcp_wrappers -, udev -, waylandpp -, writeShellScript -, xkeyboard_config -, xorg -, xz -, zstd +{ + alsa-lib, + autoPatchelfHook, + buildFHSEnv, + dbus, + elfutils, + expat, + extraEnv ? { }, + fetchFromGitLab, + fetchurl, + glib, + glibc, + lib, + libGL, + libapparmor, + libbsd, + libedit, + libffi_3_3, + libgcrypt, + libglvnd, + makeShellWrapper, + sqlite, + squashfsTools, + stdenv, + tcp_wrappers, + udev, + waylandpp, + writeShellScript, + xkeyboard_config, + xorg, + xz, + zstd, }: let pname = "plex-desktop"; @@ -104,48 +105,51 @@ let dontWrapQtApps = true; - installPhase = - '' - runHook preInstall + installPhase = '' + runHook preInstall - cp -r . $out + cp -r . $out - ln -s ${libedit}/lib/libedit.so.0 $out/lib/libedit.so.2 - rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2 - ln -s ${alsa-lib}/lib/libasound.so.2 $out/usr/lib/x86_64-linux-gnu/libasound.so.2 - rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 - ln -s ${alsa-lib}/lib/libasound.so.2.0.0 $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 + ln -s ${libedit}/lib/libedit.so.0 $out/lib/libedit.so.2 + rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2 + ln -s ${alsa-lib}/lib/libasound.so.2 $out/usr/lib/x86_64-linux-gnu/libasound.so.2 + rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 + ln -s ${alsa-lib}/lib/libasound.so.2.0.0 $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 - runHook postInstall - ''; + runHook postInstall + ''; }; in buildFHSEnv { - name = "${pname}-${version}"; - targetPkgs = pkgs: [ xkeyboard_config ]; + name = "${pname}-${version}"; + targetPkgs = pkgs: [ xkeyboard_config ]; - extraInstallCommands = '' - mkdir -p $out/share/applications $out/share/icons/hicolor/scalable/apps - install -m 444 -D ${plex-desktop}/meta/gui/plex-desktop.desktop $out/share/applications/plex-desktop.desktop - substituteInPlace $out/share/applications/plex-desktop.desktop \ - --replace-fail \ - 'Icon=''${SNAP}/meta/gui/icon.png' \ - 'Icon=${plex-desktop}/meta/gui/icon.png' \ - --replace-fail \ - 'Exec=plex-desktop' \ - 'Exec=plex-desktop-${version}' - ''; + extraInstallCommands = '' + mkdir -p $out/share/applications $out/share/icons/hicolor/scalable/apps + install -m 444 -D ${plex-desktop}/meta/gui/plex-desktop.desktop $out/share/applications/plex-desktop.desktop + substituteInPlace $out/share/applications/plex-desktop.desktop \ + --replace-fail \ + 'Icon=''${SNAP}/meta/gui/icon.png' \ + 'Icon=${plex-desktop}/meta/gui/icon.png' \ + --replace-fail \ + 'Exec=plex-desktop' \ + 'Exec=plex-desktop-${version}' + ''; - runScript = writeShellScript "plex-desktop.sh" '' - # Widevine won't download unless this directory exists. - mkdir -p $HOME/.cache/plex/ - PLEX_USR_PATH=${lib.makeSearchPath "usr/lib/x86_64-linux-gnu" [ plex-desktop ]} + runScript = writeShellScript "plex-desktop.sh" '' + # Widevine won't download unless this directory exists. + mkdir -p $HOME/.cache/plex/ + PLEX_USR_PATH=${lib.makeSearchPath "usr/lib/x86_64-linux-gnu" [ plex-desktop ]} - set -o allexport - LD_LIBRARY_PATH=${lib.makeLibraryPath [ plex-desktop libglvnd-1_4_0 ]}:$PLEX_USR_PATH - LIBGL_DRIVERS_PATH=$PLEX_USR_PATH/dri - ${lib.toShellVars extraEnv} - exec ${plex-desktop}/Plex.sh + set -o allexport + LD_LIBRARY_PATH=${ + lib.makeLibraryPath [ + plex-desktop + libglvnd-1_4_0 + ] + }:$PLEX_USR_PATH + LIBGL_DRIVERS_PATH=$PLEX_USR_PATH/dri + ${lib.toShellVars extraEnv} + exec ${plex-desktop}/Plex.sh ''; } - From 4e3b69e11085749f7e971a564043d219a0eb8ac1 Mon Sep 17 00:00:00 2001 From: detroyejr Date: Tue, 1 Oct 2024 16:04:48 -0400 Subject: [PATCH 2/2] plex-desktop: inherit pname, meta, and enable update.sh Replaces #328708 and closes https://github.com/NixOS/nixpkgs/issues/345618 --- pkgs/by-name/pl/plex-desktop/package.nix | 3 ++- pkgs/by-name/pl/plex-desktop/update.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/pl/plex-desktop/package.nix b/pkgs/by-name/pl/plex-desktop/package.nix index fe5949f22cb1e..ba793768d6346 100644 --- a/pkgs/by-name/pl/plex-desktop/package.nix +++ b/pkgs/by-name/pl/plex-desktop/package.nix @@ -121,7 +121,7 @@ let }; in buildFHSEnv { - name = "${pname}-${version}"; + inherit pname version meta; targetPkgs = pkgs: [ xkeyboard_config ]; extraInstallCommands = '' @@ -152,4 +152,5 @@ buildFHSEnv { ${lib.toShellVars extraEnv} exec ${plex-desktop}/Plex.sh ''; + passthru.updateScript = ./update.sh; } diff --git a/pkgs/by-name/pl/plex-desktop/update.sh b/pkgs/by-name/pl/plex-desktop/update.sh index 0cc509fb2b729..df51f79be0d9e 100755 --- a/pkgs/by-name/pl/plex-desktop/update.sh +++ b/pkgs/by-name/pl/plex-desktop/update.sh @@ -73,6 +73,7 @@ sed --regexp-extended \ # try to build the updated version # +export NIXPKGS_ALLOW_UNFREE=1 if ! nix-build -A plex-desktop "$nixpkgs"; then echo "The updated plex-desktop failed to build." exit 1