Unverified Commit e7543ac5 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #231534 from figsoda/spotify-tui

spotify-tui: unpin openssl, fix license, clean up
parents dd584d82 f508d6b6
Loading
Loading
Loading
Loading
+2704 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −11
Original line number Diff line number Diff line
--- a/Cargo.lock	2022-04-27 17:25:49.017415644 +0300
+++ b/Cargo.lock	2022-04-27 17:25:51.307433984 +0300
@@ -1722,8 +1722,6 @@
 [[package]]
 name = "rspotify"
 version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eefd7bb58b714606b30a490f751d7926942e2874eef5e82934d60d7a4a68dca4"
 dependencies = [
  "base64 0.10.1",
  "chrono",
+0 −12
Original line number Diff line number Diff line
--- a/Cargo.toml	2022-04-25 18:20:04.329712912 +0200
+++ b/Cargo.toml	2022-04-25 18:20:44.296429608 +0200
@@ -29,6 +29,9 @@
 rand = "0.8.3"
 anyhow = "1.0.43"
 
+[patch.crates-io]
+rspotify = { path = "./rspotify-0.10.0" }
+
 [[bin]]
 bench = false
 path = "src/main.rs"
+16 −55
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchCrate
, fetchpatch
, rustPlatform
, fetchFromGitHub
, stdenv
, installShellFiles
, pkg-config
, openssl
@@ -24,62 +22,25 @@ rustPlatform.buildRustPackage rec {
    hash = "sha256-L5gg6tjQuYoAC89XfKE38KCFONwSAwfNoFEUPH4jNAI=";
  };

  cargoPatches = [
    # Use patched rspotify
    ./Cargo.lock.patch

    # Needed so that the patch below it applies.
    (fetchpatch {
      name = "update-dirs.patch";
      url = "https://github.com/Rigellute/spotify-tui/commit/3881defc1ed0bcf79df1aef4836b857f64be657c.patch";
      hash = "sha256-OGqiYLFojMwR3RgKbddXxPDiAdzPySnscVVsVmTT7t4=";
    })

    # https://github.com/Rigellute/spotify-tui/pull/990
    (fetchpatch {
      name = "update-socket2-for-rust-1.64.patch";
      url = "https://github.com/Rigellute/spotify-tui/commit/14df9419cf72da13f3b55654686a95647ea9dfea.patch";
      hash = "sha256-craY6UwmHDdxih3nZBdPkNJtQ6wvVgf09Ovqdxi0JZo=";
    })
  ];

  patches = [
    # Use patched rspotify
    ./Cargo.toml.patch
  ];

  preBuild = let
    rspotify = stdenv.mkDerivation rec {
      pname = "rspotify";
      version = "0.10.0";

      src = fetchCrate {
        inherit pname version;
        sha256 = "sha256-KDtqjVQlMHlhL1xXP3W1YG/YuX9pdCjwW/7g18469Ts=";
      };

      dontBuild = true;
      installPhase = ''
        mkdir $out
        cp -R . $out
      '';

      patches = [
        # add `collection` variant
        ./0001-Add-Collection-SearchType.patch
      ];
  cargoLock = {
    lockFile = ./Cargo.lock;
  };
  in ''
    ln -s ${rspotify} ./rspotify-${rspotify.version}
  '';

  cargoHash = "sha256-aZJ6Q/rvqrv+wvQw2eKFPnSROhI5vXPvr5pu1hwtZKA=";

  nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.isLinux [ pkg-config python3 ];
  buildInputs = [ ]
    ++ lib.optionals stdenv.isLinux [ openssl libxcb ]
    ++ lib.optionals stdenv.isDarwin [ AppKit Security ];

  postPatch = ''
    # update Cargo.lock to fix build
    ln -sf ${./Cargo.lock} Cargo.lock

    # Add patch adding the collection variant to rspotify used by spotify-tu
    # This fixes the issue of getting an error when playing liked songs
    # see https://github.com/NixOS/nixpkgs/pull/170915
    patch -p1 -d $cargoDepsCopy/rspotify-0.10.0 < ${./0001-Add-Collection-SearchType.patch}
  '';

  postInstall = ''
    for shell in bash fish zsh; do
      $out/bin/spt --completions $shell > spt.$shell
@@ -91,7 +52,7 @@ rustPlatform.buildRustPackage rec {
    description = "Spotify for the terminal written in Rust";
    homepage = "https://github.com/Rigellute/spotify-tui";
    changelog = "https://github.com/Rigellute/spotify-tui/blob/v${version}/CHANGELOG.md";
    license = licenses.mit;
    license = with licenses; [ mit /* or */ asl20 ];
    maintainers = with maintainers; [ jwijenbergh ];
    mainProgram = "spt";
  };
+0 −1
Original line number Diff line number Diff line
@@ -33849,7 +33849,6 @@ with pkgs;
  spotify-tui = callPackage ../applications/audio/spotify-tui {
    inherit (darwin.apple_sdk.frameworks) AppKit Security;
    openssl = openssl_1_1;
  };
  sptlrx = callPackage ../applications/audio/sptlrx { };