13 stdenv.mkDerivation (finalAttrs: {
19 desktopName = "YouTube Music Desktop App";
23 genericName = finalAttrs.meta.description;
24 mimeTypes = [ "x-scheme-handler/ytmd" ];
30 startupWMClass = "YouTube Music Desktop App";
42 url = "https://github.com/ytmdesktop/ytmdesktop/releases/download/v${finalAttrs.version}/youtube-music-desktop-app_${finalAttrs.version}_amd64.deb";
43 hash = "sha256-0j8HVmkFyTk/Jpq9dfQXFxd2jnLwzfEiqCgRHuc5g9o=";
49 ar x $src data.tar.zst
56 pushd usr/lib/youtube-music-desktop-app
58 asar extract resources/app.asar patched-asar
60 # workaround for https://github.com/electron/electron/issues/31121
61 substituteInPlace patched-asar/.webpack/main/index.js \
62 --replace-fail "process.resourcesPath" "'$out/lib/resources'"
64 asar pack patched-asar resources/app.asar
72 mkdir -p $out/{lib,share/pixmaps}
74 cp -r usr/lib/youtube-music-desktop-app/{locales,resources{,.pak}} $out/lib
75 cp usr/share/pixmaps/youtube-music-desktop-app.png $out/share/pixmaps/ytmdesktop.png
83 makeWrapper ${lib.getExe electron_30} $out/bin/ytmdesktop \
84 --add-flags $out/lib/resources/app.asar \
85 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
86 --add-flags ${lib.escapeShellArg commandLineArgs}
92 changelog = "https://github.com/ytmdesktop/ytmdesktop/tag/v${finalAttrs.version}";
93 description = "A Desktop App for YouTube Music";
94 downloadPage = "https://github.com/ytmdesktop/ytmdesktop/releases";
95 homepage = "https://ytmdesktop.app/";
96 license = lib.licenses.gpl3Only;
97 mainProgram = finalAttrs.pname;
98 maintainers = [ lib.maintainers.cjshearer ];
99 inherit (electron_30.meta) platforms;
100 # While the files we extract from the .deb are cross-platform (javascript), the installation
101 # process for darwin is different, and I don't have a test device. PRs are welcome if you can
102 # add the correct installation steps. I would suggest looking at the following:
103 # https://www.electronjs.org/docs/latest/tutorial/application-distribution#manual-packaging
104 # https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/instant-messengers/jitsi-meet-electron/default.nix
105 badPlatforms = lib.platforms.darwin;