spotube: unify linux and darwin builder (#369695)
This commit is contained in:
@@ -20,37 +20,73 @@
|
||||
webkitgtk_4_1,
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "spotube";
|
||||
version = "3.9.0";
|
||||
|
||||
meta = {
|
||||
description = "Open source, cross-platform Spotify client compatible across multiple platforms";
|
||||
longDescription = ''
|
||||
Spotube is an open source, cross-platform Spotify client compatible across
|
||||
multiple platforms utilizing Spotify's data API and YouTube (or Piped.video or JioSaavn)
|
||||
as an audio source, eliminating the need for Spotify Premium
|
||||
'';
|
||||
downloadPage = "https://github.com/KRTirtho/spotube/releases";
|
||||
homepage = "https://spotube.krtirtho.dev/";
|
||||
license = lib.licenses.bsdOriginal;
|
||||
mainProgram = "spotube";
|
||||
maintainers = with lib.maintainers; [ tomasajt ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
];
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
src = finalAttrs.passthru.sources.${stdenv.hostPlatform.system};
|
||||
|
||||
sources =
|
||||
sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin ".";
|
||||
|
||||
nativeBuildInputs =
|
||||
lib.optionals stdenv.hostPlatform.isLinux [
|
||||
autoPatchelfHook
|
||||
dpkg
|
||||
makeWrapper
|
||||
wrapGAppsHook3
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
undmg
|
||||
makeBinaryWrapper
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
glib-networking
|
||||
gtk3
|
||||
libappindicator
|
||||
libnotify
|
||||
libsoup_3
|
||||
mpv-unwrapped
|
||||
webkitgtk_4_1
|
||||
];
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
${lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
mkdir -p $out
|
||||
cp -r usr/* $out
|
||||
''}
|
||||
|
||||
${lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
mkdir -p $out/Applications
|
||||
cp -r Spotube.app $out/Applications
|
||||
makeBinaryWrapper $out/Applications/Spotube.app/Contents/MacOS/Spotube $out/bin/spotube
|
||||
''}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
patchelf $out/share/spotube/lib/libmedia_kit_native_event_loop.so \
|
||||
--replace-needed libmpv.so.1 libmpv.so
|
||||
'';
|
||||
|
||||
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
makeWrapper $out/share/spotube/spotube $out/bin/spotube \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--prefix LD_LIBRARY_PATH : $out/share/spotube/lib:${lib.makeLibraryPath [ mpv-unwrapped ]} \
|
||||
--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs ]}
|
||||
'';
|
||||
|
||||
passthru.sources =
|
||||
let
|
||||
fetchArtifact =
|
||||
{ filename, hash }:
|
||||
fetchurl {
|
||||
url = "https://github.com/KRTirtho/spotube/releases/download/v${version}/${filename}";
|
||||
url = "https://github.com/KRTirtho/spotube/releases/download/v${finalAttrs.version}/${filename}";
|
||||
inherit hash;
|
||||
};
|
||||
in
|
||||
@@ -73,81 +109,19 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
src = sources.${stdenv.hostPlatform.system};
|
||||
|
||||
darwin = stdenv.mkDerivation {
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
meta
|
||||
src
|
||||
;
|
||||
|
||||
passthru = { inherit sources; };
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [
|
||||
undmg
|
||||
makeBinaryWrapper
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/Applications $out/bin
|
||||
cp -r spotube.app $out/Applications
|
||||
makeBinaryWrapper $out/Applications/spotube.app/Contents/MacOS/spotube $out/bin/spotube
|
||||
runHook postInstall
|
||||
meta = {
|
||||
description = "Open source, cross-platform Spotify client compatible across multiple platforms";
|
||||
longDescription = ''
|
||||
Spotube is an open source, cross-platform Spotify client compatible across
|
||||
multiple platforms utilizing Spotify's data API and YouTube (or Piped.video or JioSaavn)
|
||||
as an audio source, eliminating the need for Spotify Premium
|
||||
'';
|
||||
downloadPage = "https://github.com/KRTirtho/spotube/releases";
|
||||
homepage = "https://spotube.krtirtho.dev/";
|
||||
license = lib.licenses.bsdOriginal;
|
||||
mainProgram = "spotube";
|
||||
maintainers = with lib.maintainers; [ tomasajt ];
|
||||
platforms = lib.attrNames finalAttrs.passthru.sources;
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
|
||||
linux = stdenv.mkDerivation {
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
meta
|
||||
src
|
||||
;
|
||||
|
||||
passthru = { inherit sources; };
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
dpkg
|
||||
makeWrapper
|
||||
wrapGAppsHook3
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
glib-networking
|
||||
gtk3
|
||||
libappindicator
|
||||
libnotify
|
||||
libsoup_3
|
||||
mpv-unwrapped
|
||||
webkitgtk_4_1
|
||||
];
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r usr/* $out
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
patchelf $out/share/spotube/lib/libmedia_kit_native_event_loop.so \
|
||||
--replace-needed libmpv.so.1 libmpv.so
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
makeWrapper $out/share/spotube/spotube $out/bin/spotube \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--prefix LD_LIBRARY_PATH : $out/share/spotube/lib:${lib.makeLibraryPath [ mpv-unwrapped ]} \
|
||||
--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs ]}
|
||||
'';
|
||||
};
|
||||
in
|
||||
if stdenv.hostPlatform.isDarwin then darwin else linux
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user