depot/third_party/nixpkgs/pkgs/by-name/la/lastfm/package.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

57 lines
1.3 KiB
Nix

{ lib
, fetchzip
, stdenvNoCC
, writeShellApplication
, curl
, xmlstarlet
, common-updater-scripts
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "lastfm";
version = "2.1.39";
src = fetchzip {
extension = "zip";
name = "Last.fm.app";
url = "https://cdn.last.fm/client/Mac/Last.fm-${finalAttrs.version}.zip";
hash = "sha256-jxFh0HbY4g5xcvAI20b92dL1FRvRqPwBBa0Cv9k63+s=";
};
dontConfigure = true;
dontBuild = true;
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p "$out/Applications"
cp -r *.app "$out/Applications"
runHook postInstall
'';
passthru.updateScript = lib.getExe (writeShellApplication {
name = "lastfm-update-script";
runtimeInputs = [
curl
xmlstarlet
common-updater-scripts
];
text = ''
url=$(curl --silent "https://cdn.last.fm/client/Mac/updates.xml")
version=$(echo "$url" | xmlstarlet sel -t -v "substring-before(substring-after(//enclosure/@url, 'version='), '&')")
update-source-version lastfm "$version"
'';
});
meta = {
description = "Music services manager";
homepage = "https://www.last.fm/";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ iivusly ];
platforms = lib.platforms.darwin;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})