From 8304b41c7115005255b354f29cbea4f17f168a94 Mon Sep 17 00:00:00 2001 From: xeals Date: Sat, 17 Oct 2020 12:47:43 +1100 Subject: [PATCH] spotify-ripper: merge python2Packages for deps --- default.nix | 48 +++++++++++++++++++++- pkgs/tools/misc/spotify-ripper/default.nix | 48 +++------------------- 2 files changed, 52 insertions(+), 44 deletions(-) diff --git a/default.nix b/default.nix index ddab27b..e603535 100644 --- a/default.nix +++ b/default.nix @@ -101,6 +101,50 @@ rec { patches = (oldAttrs.patches or [ ]) ++ [ ./pkgs/applications/misc/polybar/9button.patch ]; }); + python2Packages = + let + fixVersion = + { package + , version + , sha256 + , extra ? (oldAttrs: { }) + }: package.overrideAttrs (oldAttrs: rec { + inherit version; + src = pkgs.python2Packages.fetchPypi { + inherit (oldAttrs) pname; + inherit version sha256; + }; + } // extra oldAttrs); + in + pkgs.recurseIntoAttrs rec { + colorama_0_3_3 = fixVersion { + package = pkgs.python2Packages.colorama; + version = "0.3.3"; + sha256 = "1716z9pq1r5ys3nkg7wdrb3h2f9rmd0zdxpxzmx3bgwgf6xg48gb"; + }; + + mutagen_1_30 = fixVersion { + package = pkgs.python2Packages.mutagen; + version = "1.30"; + sha256 = "0kv2gjnzbj1w0bswmxm7wi05x6ypi7jk52s0lb8gw8s459j41gyd"; + extra = oldAttrs: { + patches = [ ]; + }; + }; + + pyspotify_2_0_5 = fixVersion { + package = pkgs.python2Packages.pyspotify; + version = "2.0.5"; + sha256 = "0y16c024rrvbvfdqj1n0k4b25b1nbza3i7kspg5b0ci2src1rm7v"; + }; + + overlay = { + colorama = colorama_0_3_3; + mutagen = mutagen_1_30; + pyspotify = pyspotify_2_0_5; + }; + }; + python3Packages = pkgs.recurseIntoAttrs { py-sonic = pkgs.python3.pkgs.callPackage ./pkgs/development/python-modules/py-sonic { }; }; @@ -118,8 +162,10 @@ rec { samrewritten = pkgs.callPackage ./pkgs/tools/misc/samrewritten { }; spotify-ripper = pkgs.callPackage ./pkgs/tools/misc/spotify-ripper { - # NOTE: Not available in 20.03. + # NOTE: Not available in 20.03. Specifying it this way lets me cheat the + # build auto-failing on 20.03 because of the attribute not existing. inherit (pkgs) fdk-aac-encoder; + python2Packages = pkgs.python2Packages // python2Packages.overlay; }; zsh-z = pkgs.callPackage ./pkgs/shells/zsh/zsh-z { }; diff --git a/pkgs/tools/misc/spotify-ripper/default.nix b/pkgs/tools/misc/spotify-ripper/default.nix index fc75681..98cfef0 100644 --- a/pkgs/tools/misc/spotify-ripper/default.nix +++ b/pkgs/tools/misc/spotify-ripper/default.nix @@ -18,44 +18,6 @@ assert m4aSupport || mp4Support -> fdk-aac-encoder.meta.available; assert oggSupport -> vorbisTools.meta.available; assert opusSupport -> opusTools.meta.available; -let - - lockPackage = - { package - , version - , sha256 - , extra ? (oldAttrs: { }) - }: package.overrideAttrs (oldAttrs: rec { - inherit version; - src = python2Packages.fetchPypi { - inherit (oldAttrs) pname; - inherit version sha256; - }; - } // extra oldAttrs); - - colorama = lockPackage { - package = python2Packages.colorama; - version = "0.3.3"; - sha256 = "1716z9pq1r5ys3nkg7wdrb3h2f9rmd0zdxpxzmx3bgwgf6xg48gb"; - }; - - mutagen = lockPackage { - package = python2Packages.mutagen; - version = "1.30"; - sha256 = "0kv2gjnzbj1w0bswmxm7wi05x6ypi7jk52s0lb8gw8s459j41gyd"; - extra = oldAttrs: { - patches = [ ]; - }; - }; - - pyspotify = lockPackage { - package = python2Packages.pyspotify; - version = "2.0.5"; - sha256 = "0y16c024rrvbvfdqj1n0k4b25b1nbza3i7kspg5b0ci2src1rm7v"; - }; - -in - python2Packages.buildPythonApplication rec { pname = "spotify-ripper"; version = "2016.12.31"; @@ -67,14 +29,14 @@ python2Packages.buildPythonApplication rec { sha256 = "003d6br20f1cf4qvmpl62bk0k4h4v66ib76wn36c23bnh9x5q806"; }; - propagatedBuildInputs = [ + propagatedBuildInputs = (with python2Packages; [ colorama mutagen pyspotify - python2Packages.requests - python2Packages.schedule - python2Packages.setuptools - + requests + schedule + setuptools + ]) ++ [ (if flacSupport then flac else null) (if alacSupport then libav else null) (if aacSupport then faac else null)