about summary refs log tree commit diff
path: root/pkgs/by-name/sp
diff options
context:
space:
mode:
authorTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-01-22 10:50:51 +0100
committerTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-01-29 13:36:05 +0100
commitd5762179dfbf798510cd8e7be709a20ff0418352 (patch)
tree6e1bcfb0177a93666174907fcd5adc1965009355 /pkgs/by-name/sp
parentd275de7163c0717b2072c0a67ea6919b0e6a9e0d (diff)
downloadnixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar.gz
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar.bz2
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar.lz
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar.xz
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.tar.zst
nixlib-d5762179dfbf798510cd8e7be709a20ff0418352.zip
spotube: init at 3.4.1
Diffstat (limited to 'pkgs/by-name/sp')
-rw-r--r--pkgs/by-name/sp/spotube/package.nix109
1 files changed, 109 insertions, 0 deletions
diff --git a/pkgs/by-name/sp/spotube/package.nix b/pkgs/by-name/sp/spotube/package.nix
new file mode 100644
index 000000000000..8b0a057daec8
--- /dev/null
+++ b/pkgs/by-name/sp/spotube/package.nix
@@ -0,0 +1,109 @@
+{ lib
+, stdenv
+, fetchurl
+
+, autoPatchelfHook
+, dpkg
+, makeWrapper
+, undmg
+, wrapGAppsHook
+
+, libappindicator
+, libnotify
+, libsecret
+, mpv-unwrapped
+, xdg-user-dirs
+}:
+
+let
+  pname = "spotube";
+  version = "3.4.1";
+
+  meta = {
+    description = "An 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.netlify.app/";
+    license = lib.licenses.bsdOriginal;
+    mainProgram = "spotube";
+    maintainers = with lib.maintainers; [ tomasajt ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
+    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
+  };
+
+  fetchArtifact = { filename, hash }:
+    fetchurl {
+      url = "https://github.com/KRTirtho/spotube/releases/download/v${version}/${filename}";
+      inherit hash;
+    };
+
+  darwin = stdenv.mkDerivation {
+    inherit pname version meta;
+
+    src = fetchArtifact {
+      filename = "Spotube-macos-universal.dmg";
+      hash = "sha256-VobLCxsmE5kGIlDDa3v5xIHkw2x2YV14fgHHcDb+bLo=";
+    };
+
+    sourceRoot = ".";
+
+    nativeBuildInputs = [ undmg ];
+
+    installPhase = ''
+      runHook preInstall
+      mkdir -p $out/Applications $out/bin
+      cp -r spotube.app $out/Applications
+      ln -s $out/Applications/spotube.app/Contents/MacOS/spotube $out/bin/spotube
+      runHook postInstall
+    '';
+  };
+
+  linux = stdenv.mkDerivation {
+    inherit pname version meta;
+
+    src = fetchArtifact {
+      filename = "Spotube-linux-x86_64.deb";
+      hash = "sha256-NEGhzNz0E8jK2NPmigzoPAvYcU7zN9YHikuXHpzWfx0=";
+    };
+
+    nativeBuildInputs = [
+      autoPatchelfHook
+      dpkg
+      makeWrapper
+      wrapGAppsHook
+    ];
+
+    buildInputs = [
+      libappindicator
+      libnotify
+      libsecret
+      mpv-unwrapped
+    ];
+
+    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.isDarwin then darwin else linux