youtube-music: use pnpm.fetchDeps

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-05-05 12:53:19 +02:00
parent 6fe1507ab2
commit b692500229
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951
2 changed files with 7 additions and 47 deletions

View File

@ -4,12 +4,9 @@
, electron
, python3
, stdenv
, stdenvNoCC
, copyDesktopItems
, moreutils
, cacert
, jq
, nodePackages
, nodejs
, pnpm
, makeDesktopItem
}:
@ -24,54 +21,17 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-nxpctEG4XoxW6jOAxGdgTEYr6YnhFRR8+5HUQLxRJB0=";
};
pnpmDeps = stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs) src version ELECTRON_SKIP_BINARY_DOWNLOAD;
nativeBuildInputs = [ jq moreutils nodePackages.pnpm cacert ];
installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm install --frozen-lockfile --ignore-script
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';
dontBuild = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = {
x86_64-linux = "sha256-bujlQxP6Lr3qPUDxYXKyb702ZJY/xbuCsu3wVDhcb+8=";
aarch64-linux = "sha256-0kyjjttpXpFVhdza5NAjGrRn++qc/N5/u2dQl7VufLE=";
x86_64-darwin = "sha256-Q37QJt/mhfpSguOlkJGKFTCrIOrpbG3OBwaD/Bg09Us=";
aarch64-darwin = "sha256-wbfjzoGa/6vIlOOVX3bKNQ2uxzph3WSofo3MGXqA6yQ=";
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-8oeloQYiwUy+GDG4R+XtiynT+8Fad4WYFWTO1KANZKQ=";
};
nativeBuildInputs = [ makeWrapper python3 nodePackages.pnpm nodePackages.nodejs ]
nativeBuildInputs = [ makeWrapper python3 nodejs pnpm.configHook ]
++ lib.optionals (!stdenv.isDarwin) [ copyDesktopItems ];
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
preBuild = ''
export HOME=$(mktemp -d)
export STORE_PATH=$(mktemp -d)
cp -Tr "$pnpmDeps" "$STORE_PATH"
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm install --offline --frozen-lockfile --ignore-script
patchShebangs node_modules/{*,.*}
'';
postBuild = lib.optionalString stdenv.isDarwin ''
cp -R ${electron}/Applications/Electron.app Electron.app
chmod -R u+w Electron.app

View File

@ -35833,7 +35833,7 @@ with pkgs;
youtube-dl-light = with python3Packages; toPythonApplication youtube-dl-light;
youtube-music = callPackage ../applications/audio/youtube-music { };
youtube-music = callPackage ../applications/audio/youtube-music { pnpm = pnpm_8; };
youtube-tui = callPackage ../applications/video/youtube-tui {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security AppKit;