From b2db28464b838f99b8ed910729237afa544dab09 Mon Sep 17 00:00:00 2001
From: Jeroen Wijenbergh <jeroenwijenbergh@protonmail.com>
Date: Sat, 12 Oct 2019 15:22:04 +0200
Subject: [PATCH 1/2] spotify-tui: init at 0.5.0

---
 maintainers/maintainer-list.nix               |  6 +++++
 .../audio/spotify-tui/default.nix             | 26 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 3 files changed, 34 insertions(+)
 create mode 100644 pkgs/applications/audio/spotify-tui/default.nix

diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 142d36fe7619..46863c9102d0 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -3271,6 +3271,12 @@
     githubId = 8460;
     name = "John Wiegley";
   };
+  jwijenbergh = {
+    email = "jeroenwijenbergh@protonmail.com";
+    github = "jwijenbergh";
+    githubId = 46386452;
+    name = "Jeroen Wijenbergh";
+  };
   jwilberding = {
     email = "jwilberding@afiniate.com";
     name = "Jordan Wilberding";
diff --git a/pkgs/applications/audio/spotify-tui/default.nix b/pkgs/applications/audio/spotify-tui/default.nix
new file mode 100644
index 000000000000..441d0efcb52b
--- /dev/null
+++ b/pkgs/applications/audio/spotify-tui/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "spotify-tui";
+  version = "0.5.0";
+  
+  src = fetchFromGitHub {
+    owner = "Rigellute";
+    repo = "spotify-tui";
+    rev = "v${version}"; 
+    sha256 = "1spnr67fb2wjjf9sfkk3vps6q45w0zrk47an79bhv4imziy4dbs3";
+  };
+
+  cargoSha256 = "029g80mcqvmckszpbzm4hxs5w63n41ah4rc1b93i9c1nzvncd811";
+  
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ openssl ];
+
+  meta = with stdenv.lib; {
+    description = "Spotify for the terminal written in Rust";
+    homepage = https://github.com/Rigellute/spotify-tui;
+    license = licenses.mit;
+    maintainers = with maintainers; [ jwijenbergh ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 14596a6dd5f1..788bb62169f9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20676,6 +20676,8 @@ in
 
   split2flac = callPackage ../applications/audio/split2flac { };
 
+  spotify-tui = callPackage ../applications/audio/spotify-tui { };
+
   squishyball = callPackage ../applications/audio/squishyball {
     ncurses = ncurses5;
   };

From c880884656ef8ae550217269f717a73e1a9a67d4 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Sat, 12 Oct 2019 18:28:15 +0200
Subject: [PATCH 2/2] spotify-tui: fix darwin build

---
 pkgs/applications/audio/spotify-tui/default.nix | 7 ++++---
 pkgs/top-level/all-packages.nix                 | 4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/pkgs/applications/audio/spotify-tui/default.nix b/pkgs/applications/audio/spotify-tui/default.nix
index 441d0efcb52b..14c9a88d4e4e 100644
--- a/pkgs/applications/audio/spotify-tui/default.nix
+++ b/pkgs/applications/audio/spotify-tui/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl }:
+{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl, Security }:
 
 rustPlatform.buildRustPackage rec {
   pname = "spotify-tui";
@@ -12,9 +12,10 @@ rustPlatform.buildRustPackage rec {
   };
 
   cargoSha256 = "029g80mcqvmckszpbzm4hxs5w63n41ah4rc1b93i9c1nzvncd811";
-  
+
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ openssl ];
+  buildInputs = [ openssl ]
+    ++ stdenv.lib.optional stdenv.isDarwin Security;
 
   meta = with stdenv.lib; {
     description = "Spotify for the terminal written in Rust";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 788bb62169f9..770fba7b7ac9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20676,7 +20676,9 @@ in
 
   split2flac = callPackage ../applications/audio/split2flac { };
 
-  spotify-tui = callPackage ../applications/audio/spotify-tui { };
+  spotify-tui = callPackage ../applications/audio/spotify-tui {
+    inherit (darwin.apple_sdk.frameworks) Security;
+  };
 
   squishyball = callPackage ../applications/audio/squishyball {
     ncurses = ncurses5;