Skip to content

Commit

Permalink
spotube: Refactor code for improved readability
Browse files Browse the repository at this point in the history
  • Loading branch information
damidoug committed Dec 30, 2024
1 parent 3359ed7 commit b4589a7
Showing 1 changed file with 61 additions and 44 deletions.
105 changes: 61 additions & 44 deletions pkgs/by-name/sp/spotube/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,42 @@ let
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 = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};

fetchArtifact =
{ filename, hash }:
fetchurl {
url = "https://github.com/KRTirtho/spotube/releases/download/v${version}/${filename}";
inherit hash;
};
src =
let
fetchArtifact =
{ filename, hash }:
fetchurl {
url = "https://github.com/KRTirtho/spotube/releases/download/v${version}/${filename}";
inherit hash;
};
sources = {
"aarch64-linux" = fetchArtifact {
filename = "Spotube-linux-aarch64.deb";
hash = "sha256-KBuUAgUU6c/rBkkbpYjSarzckIoi+gRtCkumvtaoras=";
};
"x86_64-linux" = fetchArtifact {
filename = "Spotube-linux-x86_64.deb";
hash = "sha256-vzzK3csyKYP6fKKIoysziBsc2tqrg5LXS/6KoXBtNVI=";
};
"x86_64-darwin" = fetchArtifact {
filename = "Spotube-macos-universal.dmg";
hash = "sha256-wwIIKY+bmMJZigc2AK/QMg142uvZ+D6LOddzedJM5f8=";
};
"aarch64-darwin" = fetchArtifact {
filename = "Spotube-macos-universal.dmg";
hash = "sha256-wwIIKY+bmMJZigc2AK/QMg142uvZ+D6LOddzedJM5f8=";
};
};
in
sources.${stdenv.hostPlatform.system};

darwin = stdenv.mkDerivation {
inherit pname version meta;

src = fetchArtifact {
filename = "Spotube-macos-universal.dmg";
hash = "sha256-wwIIKY+bmMJZigc2AK/QMg142uvZ+D6LOddzedJM5f8=";
};
inherit
pname
version
meta
src
;

sourceRoot = ".";

Expand All @@ -75,17 +76,12 @@ let
};

linux = stdenv.mkDerivation {
inherit pname version meta;

src = fetchArtifact {
filename =
if stdenv.hostPlatform.isAarch64 then "Spotube-linux-aarch64.deb" else "Spotube-linux-x86_64.deb";
hash =
if stdenv.hostPlatform.isAarch64 then
"sha256-KBuUAgUU6c/rBkkbpYjSarzckIoi+gRtCkumvtaoras="
else
"sha256-vzzK3csyKYP6fKKIoysziBsc2tqrg5LXS/6KoXBtNVI=";
};
inherit
pname
version
meta
src
;

nativeBuildInputs = [
autoPatchelfHook
Expand Down Expand Up @@ -125,5 +121,26 @@ let
--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs ]}
'';
};

meta = with lib; {
description = "Open source, cross-platform Spotify client compatible across multiple platforms";
downloadPage = "https://github.com/KRTirtho/spotube/releases";
homepage = "https://spotube.krtirtho.dev/";
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.
'';
license = licenses.bsdOriginal;
mainProgram = "spotube";
maintainers = [ maintainers.tomasajt ];
platforms = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
sourceProvenance = [ sourceTypes.binaryNativeCode ];
};
in
if stdenv.hostPlatform.isDarwin then darwin else linux

0 comments on commit b4589a7

Please sign in to comment.