From 3353bf7a165d5c520d31f2b62f165b605910e512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 6 Mar 2021 19:17:51 +0100 Subject: [PATCH] beets: remove ``? null``; remove ``with lib`` --- pkgs/tools/audio/beets/default.nix | 81 ++++++++++++------------------ 1 file changed, 31 insertions(+), 50 deletions(-) diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 7fea4bd28d4f..2be0b1bc76f6 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -1,24 +1,23 @@ { stdenv, lib, fetchFromGitHub, writeScript, glibcLocales, diffPlugins, substituteAll , pythonPackages, imagemagick, gobject-introspection, gst_all_1 -, runtimeShell -, unstableGitUpdater +, runtimeShell, unstableGitUpdater # external plugins package set , beetsExternalPlugins -, enableAbsubmit ? lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms, essentia-extractor ? null +, enableAbsubmit ? lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms, essentia-extractor , enableAcousticbrainz ? true , enableAcoustid ? true -, enableBadfiles ? true, flac ? null, mp3val ? null +, enableBadfiles ? true, flac, mp3val , enableBeatport ? true , enableBpsync ? true -, enableConvert ? true, ffmpeg ? null +, enableConvert ? true, ffmpeg , enableDeezer ? true , enableDiscogs ? true , enableEmbyupdate ? true , enableFetchart ? true , enableGmusic ? true -, enableKeyfinder ? true, keyfinder-cli ? null +, enableKeyfinder ? true, keyfinder-cli , enableKodiupdate ? true , enableLastfm ? true , enableLoadext ? true @@ -33,32 +32,14 @@ # External plugins , enableAlternatives ? false -, enableCheck ? false, liboggz ? null +, enableCheck ? false, liboggz , enableCopyArtifacts ? false , enableExtraFiles ? false , bashInteractive, bash-completion }: -assert enableAbsubmit -> essentia-extractor != null; -assert enableAcoustid -> pythonPackages.pyacoustid != null; -assert enableBadfiles -> flac != null && mp3val != null; -assert enableBeatport -> pythonPackages.requests_oauthlib != null; assert enableBpsync -> enableBeatport; -assert enableCheck -> flac != null && mp3val != null && liboggz != null; -assert enableConvert -> ffmpeg != null; -assert enableDiscogs -> pythonPackages.discogs_client != null; -assert enableFetchart -> pythonPackages.responses != null; -assert enableGmusic -> pythonPackages.gmusicapi != null; -assert enableKeyfinder -> keyfinder-cli != null; -assert enableLastfm -> pythonPackages.pylast != null; -assert enableMpd -> pythonPackages.mpd2 != null; -assert enableReplaygain -> ffmpeg != null; -assert enableSonosUpdate -> pythonPackages.soco != null; -assert enableThumbnails -> pythonPackages.pyxdg != null; -assert enableWeb -> pythonPackages.flask != null; - -with lib; let optionalPlugins = { @@ -99,20 +80,20 @@ let "types" "unimported" "zero" ]; - enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins); + enabledOptionalPlugins = lib.attrNames (lib.filterAttrs (_: lib.id) optionalPlugins); - allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins; + allPlugins = pluginsWithoutDeps ++ lib.attrNames optionalPlugins; allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins; testShell = "${bashInteractive}/bin/bash --norc"; completion = "${bash-completion}/share/bash-completion/bash_completion"; # This is a stripped down beets for testing of the external plugins. - externalTestArgs.beets = (beets.override { + externalTestArgs.beets = (lib.beets.override { enableAlternatives = false; enableCopyArtifacts = false; enableExtraFiles = false; - }).overrideAttrs (const { + }).overrideAttrs (lib.const { doInstallCheck = false; }); @@ -147,10 +128,10 @@ in pythonPackages.buildPythonApplication rec { pythonPackages.confuse pythonPackages.mediafile gobject-introspection - ] ++ optional enableAbsubmit essentia-extractor - ++ optional enableAcoustid pythonPackages.pyacoustid - ++ optional enableBeatport pythonPackages.requests_oauthlib - ++ optional (enableFetchart + ] ++ lib.optional enableAbsubmit essentia-extractor + ++ lib.optional enableAcoustid pythonPackages.pyacoustid + ++ lib.optional enableBeatport pythonPackages.requests_oauthlib + ++ lib.optional (enableFetchart || enableDeezer || enableEmbyupdate || enableKodiupdate @@ -160,19 +141,19 @@ in pythonPackages.buildPythonApplication rec { || enableSubsonicupdate || enableAcousticbrainz) pythonPackages.requests - ++ optional enableCheck beetsExternalPlugins.check - ++ optional enableConvert ffmpeg - ++ optional enableDiscogs pythonPackages.discogs_client - ++ optional enableGmusic pythonPackages.gmusicapi - ++ optional enableKeyfinder keyfinder-cli - ++ optional enableLastfm pythonPackages.pylast - ++ optional enableMpd pythonPackages.mpd2 - ++ optional enableSonosUpdate pythonPackages.soco - ++ optional enableThumbnails pythonPackages.pyxdg - ++ optional enableWeb pythonPackages.flask - ++ optional enableAlternatives beetsExternalPlugins.alternatives - ++ optional enableCopyArtifacts beetsExternalPlugins.copyartifacts - ++ optional enableExtraFiles beetsExternalPlugins.extrafiles + ++ lib.optional enableCheck beetsExternalPlugins.check + ++ lib.optional enableConvert ffmpeg + ++ lib.optional enableDiscogs pythonPackages.discogs_client + ++ lib.optional enableGmusic pythonPackages.gmusicapi + ++ lib.optional enableKeyfinder keyfinder-cli + ++ lib.optional enableLastfm pythonPackages.pylast + ++ lib.optional enableMpd pythonPackages.mpd2 + ++ lib.optional enableSonosUpdate pythonPackages.soco + ++ lib.optional enableThumbnails pythonPackages.pyxdg + ++ lib.optional enableWeb pythonPackages.flask + ++ lib.optional enableAlternatives beetsExternalPlugins.alternatives + ++ lib.optional enableCopyArtifacts beetsExternalPlugins.copyartifacts + ++ lib.optional enableExtraFiles beetsExternalPlugins.extrafiles ; buildInputs = [ @@ -209,12 +190,12 @@ in pythonPackages.buildPythonApplication rec { # bs1770gain, and set the absolute path there, to avoid impurities. ++ lib.optional enableReplaygain (substituteAll { src = ./replaygain-default-ffmpeg.patch; - ffmpeg = getBin ffmpeg; + ffmpeg = lib.getBin ffmpeg; }) # Put absolute Nix paths in place ++ lib.optional enableConvert (substituteAll { src = ./convert-plugin-ffmpeg-path.patch; - ffmpeg = getBin ffmpeg; + ffmpeg = lib.getBin ffmpeg; }) ++ lib.optional enableBadfiles (substituteAll { src = ./badfiles-plugin-nix-paths.patch; @@ -269,7 +250,7 @@ in pythonPackages.buildPythonApplication rec { EDITOR="${writeScript "beetconfig.sh" '' #!${runtimeShell} cat > "$1" <