Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ytmdesktop: init at 2.0.5 #317309

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions pkgs/by-name/yt/ytmdesktop/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
lib,
asar,
binutils,
commandLineArgs ? "",
copyDesktopItems,
electron_30,
fetchurl,
makeDesktopItem,
makeWrapper,
nix-update-script,
stdenv,
zstd,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ytmdesktop";
version = "2.0.5";

desktopItem = makeDesktopItem {
desktopName = "Youtube Music Desktop App";
exec = "ytmdesktop";
icon = "ytmdesktop";
name = "ytmdesktop";
genericName = finalAttrs.meta.description;
mimeTypes = [ "x-scheme-handler/ytmd" ];
categories = [
"AudioVideo"
"Audio"
];
startupNotify = true;
};

nativeBuildInputs = [
asar
copyDesktopItems
makeWrapper
zstd
];

src = fetchurl {
url = "https://github.com/ytmdesktop/ytmdesktop/releases/download/v${finalAttrs.version}/youtube-music-desktop-app_${finalAttrs.version}_amd64.deb";
hash = "sha256-0j8HVmkFyTk/Jpq9dfQXFxd2jnLwzfEiqCgRHuc5g9o=";
};

unpackPhase = ''
runHook preUnpack

ar x $src data.tar.zst
tar xf data.tar.zst

runHook preUnpack
'';

postPatch = ''
pushd usr/lib/youtube-music-desktop-app

asar extract resources/app.asar patched-asar

# workaround for https://github.com/electron/electron/issues/31121
substituteInPlace patched-asar/.webpack/main/index.js \
--replace-fail "process.resourcesPath" "'$out/lib/resources'"

asar pack patched-asar resources/app.asar

popd
'';

installPhase = ''
runHook preInstall

mkdir -p $out/{lib,share/pixmaps}

cp -r usr/lib/youtube-music-desktop-app/{locales,resources{,.pak}} $out/lib
cp usr/share/pixmaps/youtube-music-desktop-app.png $out/share/pixmaps/ytmdesktop.png

runHook postInstall
'';

fixupPhase = ''
runHook preFixup

makeWrapper ${lib.getExe electron_30} $out/bin/ytmdesktop \
--add-flags $out/lib/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--add-flags ${lib.escapeShellArg commandLineArgs}

runHook preFixup
'';

meta = {
changelog = "https://github.com/ytmdesktop/ytmdesktop/tag/v${finalAttrs.version}";
description = "A Desktop App for YouTube Music";
downloadPage = "https://github.com/ytmdesktop/ytmdesktop/releases";
homepage = "https://ytmdesktop.app/";
license = lib.licenses.gpl3Only;
mainProgram = finalAttrs.pname;
maintainers = [ lib.maintainers.cjshearer ];
inherit (electron_30.meta) platforms;
# While the files we extract from the .deb are cross-platform (javascript), the installation
# process for darwin is different, and I don't have a test device. PRs are welcome if you can
# add the correct installation steps. I would suggest looking at the following:
# https://www.electronjs.org/docs/latest/tutorial/application-distribution#manual-packaging
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/instant-messengers/jitsi-meet-electron/default.nix
badPlatforms = lib.platforms.darwin;
};
})
1 change: 0 additions & 1 deletion pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,6 @@ mapAliases ({
yarn2nix-moretea-openssl_1_1 = throw "'yarn2nix-moretea-openssl_1_1' has been removed."; # Added 2023-02-04
yi = throw "'yi' has been removed, as it was broken and unmaintained"; # added 2024-05-09
yrd = throw "'yrd' has been removed, as it was broken and unmaintained"; # added 2024-05-27
ytmdesktop = throw "ytmdesktop was removed because upstream vanished"; # added 2024-03-24
yubikey-manager4 = throw "yubikey-manager4 has been removed, since it is no longer required by yubikey-manager-qt. Please update to yubikey-manager."; # Added 2024-01-14
yuzu-ea = throw "yuzu-ea has been removed from nixpkgs, as it has been taken down upstream"; # Added 2024-03-04
yuzu-early-access = throw "yuzu-early-access has been removed from nixpkgs, as it has been taken down upstream"; # Added 2024-03-04
Expand Down