14 stdenv.mkDerivation (finalAttrs: {
15 pname = "youtube-music";
18 src = fetchFromGitHub {
20 repo = "youtube-music";
21 rev = "v${finalAttrs.version}";
22 hash = "sha256-gZ3EvIjPa/THRwMigglGp+Wtv+wEN7V11KOu1QsyJpE=";
25 pnpmDeps = pnpm.fetchDeps {
26 inherit (finalAttrs) pname version src;
27 hash = "sha256-4yeLfolBquKFjKB4iYj8rMPvclfpjwHhV6/Xb/YNQWo=";
35 ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ copyDesktopItems ];
37 ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
40 lib.optionalString stdenv.hostPlatform.isDarwin ''
41 cp -R ${electron.dist}/Electron.app Electron.app
42 chmod -R u+w Electron.app
46 ./node_modules/.bin/electron-builder \
48 -c.electronDist=${if stdenv.hostPlatform.isDarwin then "." else electron.dist} \
49 -c.electronVersion=${electron.version}
57 + lib.optionalString stdenv.hostPlatform.isDarwin ''
58 mkdir -p $out/{Applications,bin}
59 mv pack/mac*/YouTube\ Music.app $out/Applications
60 makeWrapper $out/Applications/YouTube\ Music.app/Contents/MacOS/YouTube\ Music $out/bin/youtube-music
62 + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
63 mkdir -p "$out/share/lib/youtube-music"
64 cp -r pack/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/youtube-music"
66 pushd assets/generated/icons/png
68 install -Dm0644 $file $out/share/icons/hicolor/''${file//.png}/apps/youtube-music.png
77 postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
78 makeWrapper ${electron}/bin/electron $out/bin/youtube-music \
79 --add-flags $out/share/lib/youtube-music/resources/app.asar \
80 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
81 --set-default ELECTRON_FORCE_IS_PACKAGED 1 \
82 --set-default ELECTRON_IS_DEV 0 \
88 name = "youtube-music";
89 exec = "youtube-music %u";
90 icon = "youtube-music";
91 desktopName = "YouTube Music";
92 startupWMClass = "com.github.th_ch.youtube_music";
93 categories = [ "AudioVideo" ];
98 description = "Electron wrapper around YouTube Music";
99 homepage = "https://th-ch.github.io/youtube-music/";
100 changelog = "https://github.com/th-ch/youtube-music/blob/master/changelog.md#${
101 lib.replaceStrings [ "." ] [ "" ] finalAttrs.src.rev
103 license = licenses.mit;
104 maintainers = with maintainers; [
108 mainProgram = "youtube-music";