Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spotify-tui: add collection variant patch #170915

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 408e6a5170bbe9f854bf46e1cbae21265cf25294 Mon Sep 17 00:00:00 2001
From: Florian Bruhin <[email protected]>
Date: Mon, 25 Apr 2022 18:39:07 +0200
Subject: [PATCH] Add Collection SearchType

Backport of https://github.com/ramsayleung/rspotify/pull/306
---
src/senum.rs | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/senum.rs b/src/senum.rs
index c94c31c..79d8730 100644
--- a/src/senum.rs
+++ b/src/senum.rs
@@ -87,6 +87,7 @@ pub enum Type {
User,
Show,
Episode,
+ Collection,
}
impl Type {
pub fn as_str(&self) -> &str {
@@ -98,6 +99,7 @@ pub fn as_str(&self) -> &str {
Type::User => "user",
Type::Show => "show",
Type::Episode => "episode",
+ Type::Collection => "collection",
}
}
}
@@ -112,6 +114,7 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
"user" => Ok(Type::User),
"show" => Ok(Type::Show),
"episode" => Ok(Type::Episode),
+ "collection" => Ok(Type::Collection),
_ => Err(Error::new(ErrorKind::NoEnum(s.to_owned()))),
}
}
--
2.35.3

11 changes: 11 additions & 0 deletions pkgs/applications/audio/spotify-tui/Cargo.lock.patch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkgs/applications/audio/spotify-tui/Cargo.toml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- 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"
37 changes: 35 additions & 2 deletions pkgs/applications/audio/spotify-tui/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, installShellFiles, pkg-config, openssl, python3, libxcb, AppKit, Security }:
{ lib, stdenv, fetchFromGitHub, fetchCrate, rustPlatform, installShellFiles, pkg-config, openssl, python3, libxcb, AppKit, Security }:

rustPlatform.buildRustPackage rec {
pname = "spotify-tui";
Expand All @@ -11,7 +11,40 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-L5gg6tjQuYoAC89XfKE38KCFONwSAwfNoFEUPH4jNAI=";
};

cargoSha256 = "sha256-iucI4/iMF+uXRlnMttobu4xo3IQXq7tGiSSN8eCrLM0=";
# Use patched rspotify
cargoPatches = [
./Cargo.lock.patch
];
patches = [
./Cargo.toml.patch
];
Comment on lines +15 to +20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargoPatches = [
./Cargo.lock.patch
];
patches = [
./Cargo.toml.patch
];
cargoPatches = [
./Cargo.lock.patch
];

and I would suggest to combine the patch into one file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described above, the derivation strangely won't build if the patches are applied through one patch file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @MoritzBoehme said, we have tried this already


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}
'';

cargoSha256 = "sha256-S8zuVYcyYvrwggIvlpxNydhoN9kx6xLBwYJSHcbEK40=";

nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.isLinux [ pkg-config python3 ];
buildInputs = [ ]
Expand Down