anchor.diff:      "types" "unimported" "zero"
     ];
   
  -  enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
  -
  -  allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins;
  +  enabledOptionalPlugins = lib.attrNames (lib.filterAttrs (_: lib.id) 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;
     });
   
  
positive.code: 
  # External plugins
  , enableAlternatives     ? false
  , enableCheck            ? false, liboggz ? null
  , 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 = {
  
negative.code:     EDITOR="${writeScript "beetconfig.sh" ''
        #!${runtimeShell}
        cat > "$1" <<CFG
        plugins: ${lib.concatStringsSep " " allEnabledPlugins}
        CFG
      ''}" HOME="$tmphome" "$out/bin/beet" config -e
      EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
  