spotify-tui: unpin openssl, fix license, clean up

This commit is contained in:
figsoda 2023-05-12 17:08:29 -04:00
parent 9eff6f4469
commit f508d6b65b
5 changed files with 2720 additions and 79 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
--- 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",

View file

@ -1,12 +0,0 @@
--- 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"

View file

@ -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";
};

View file

@ -33864,7 +33864,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 { };