summary refs log tree commit diff
path: root/pkgs/applications/audio/spotify-tui/default.nix
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-05-12 17:08:29 -0400
committerfigsoda <figsoda@pm.me>2023-05-12 17:08:29 -0400
commitf508d6b65b44148f74b8e2ffa2833e76ac68cd9f (patch)
tree3972d453503cfffb5cc7ee6d5151575826646e25 /pkgs/applications/audio/spotify-tui/default.nix
parent9eff6f4469faca0e6114435ea134d7bc4be88eca (diff)
downloadnixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar.gz
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar.bz2
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar.lz
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar.xz
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.tar.zst
nixpkgs-f508d6b65b44148f74b8e2ffa2833e76ac68cd9f.zip
spotify-tui: unpin openssl, fix license, clean up
Diffstat (limited to 'pkgs/applications/audio/spotify-tui/default.nix')
-rw-r--r--pkgs/applications/audio/spotify-tui/default.nix71
1 files changed, 16 insertions, 55 deletions
diff --git a/pkgs/applications/audio/spotify-tui/default.nix b/pkgs/applications/audio/spotify-tui/default.nix
index 3011b712fe2..bca06406eba 100644
--- a/pkgs/applications/audio/spotify-tui/default.nix
+++ b/pkgs/applications/audio/spotify-tui/default.nix
@@ -1,9 +1,7 @@
 { 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
-      ];
-    };
-  in ''
-    ln -s ${rspotify} ./rspotify-${rspotify.version}
-  '';
-
-  cargoHash = "sha256-aZJ6Q/rvqrv+wvQw2eKFPnSROhI5vXPvr5pu1hwtZKA=";
+  cargoLock = {
+    lockFile = ./Cargo.lock;
+  };
 
   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";
   };