How to use Beetcamp as Beets plugin

I cannot figure out how to use Beetcamp with Beets. There was a refactoring that hit unstable a few weeks ago, I’m not sure if that has anything to do with it. Is anyone using Beetcamp on unstable? This snippet from my Home Manager config doesn’t work:

programs.beets = {
  enable = true;
  package = pkgs.python3.pkgs.beets.override {
    pluginOverrides = {
      bandcamp = {
        enable = true;
        propagatedBuildInputs = [ pkgs.python3.pkgs.beetcamp ];
      };
    };
  };
};

Error message:

Running phase: pythonCatchConflictsPhase
@nix { "action": "setPhase", "phase": "pythonCatchConflictsPhase" }
Found duplicated packages in closure for dependency 'beets': 
  beets 2.5.1 (/nix/store/lazwcfrpwlyp8paysq51mjambik08z7j-python3.13-beets-2.5.1)
    dependency chain:
      this derivation: /nix/store/lazwcfrpwlyp8paysq51mjambik08z7j-python3.13-beets-2.5.1
  beets 2.5.1 (/nix/store/3qjkivjbldrvpnsg49phh09smwh5fxzf-python3.13-beets-2.5.1)
    dependency chain:
      this derivation: /nix/store/lazwcfrpwlyp8paysq51mjambik08z7j-python3.13-beets-2.5.1
      ...depending on: /nix/store/xvzb21bi9grdf678nbjbpczdhngl2qmf-python3.13-beetcamp-0.22.0
      ...depending on: /nix/store/3qjkivjbldrvpnsg49phh09smwh5fxzf-python3.13-beets-2.5.1

Package duplicates found in closure, see above. Usually this happens if two packages depend on different version of the same dependency.

Hey dude did you ever solve this?

My understanding is that beetcamp depend on basecamp, but when we override it it creates this problem where overriddenBeets depends on beetcamp that depends on beets (vanilla edition).

Unfortunately I have no idea about how to solve this :frowning:

I actually managed to install it, but now I am affected by support data_source_mismatch_penalty · Issue #85 · snejus/beetcamp · GitHub

instead of overriding beets I’m installing a custom python interpreter with both beets and beetcamp

pkgs.python3.withPackages (ps: [
ps.beets
ps.beetcamp
]);

The plugin loads fine
beet version
beets version 2.5.1
Python version 3.13.9
plugins: advancedrewrite, badfiles, bandcamp, discogs, edit, embedart, fetchart, info, lyrics, mbsubmit, mbsync, musicbrainz, replaygain, unimported

mybeets = pkgs.python3.withPackages (ps: [
      ps.beets
      (ps.beetcamp.overrideAttrs rec {
        version = "0.23.0";
        src = pkgs.fetchFromGitHub {
          owner = "snejus";
          repo = "beetcamp";
          tag = version;
          hash = "sha256-8FEDpobEGZ0Lw1+JRoFIEe3AuiuX7dwsRab+P3hC3W0=";
        };

        # the included path do not apply to 0.23.0, it disables some tests
        patches = [];
        doCheck = false;
        doInstallCheck = false;
      })
    ]);

This works :smiley:

PR for updating python3Packages.beetcamp: 0.22.0 -> 0.23.0 by nolith · Pull Request #472456 · NixOS/nixpkgs · GitHub

@nolith, you’re a star! I actually had a beetcamp overlay hanging around but this helped me realise I was never calling it in in the correct way!

Now in my HM config I have

home.packages = with pkgs; [
  ...
  (python3Packages.beets.override {
    pluginOverrides = {
      bandcamp = {
        enable = true;
        propagatedBuildInputs = [ beetcamp ];
      };
      alternatives = {
        enable = true;
        propagatedBuildInputs = [ python3Packages.beets-alternatives ];
      };
    };
  })
  ffmpeg
  ...
]

and in packages/beetcamp/package.nix I have

{
  lib,
  python3,
  fetchFromGitHub,
  pkgs,
}:

python3.pkgs.buildPythonApplication rec {
  pname = "beetcamp";
  version = "0.23.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "snejus";
    repo = "beetcamp";
    rev = version;
    hash = "sha256-8FEDpobEGZ0Lw1+JRoFIEe3AuiuX7dwsRab+P3hC3W0=";
  };

  build-system = [ python3.pkgs.poetry-core ];

  preBuild = ''
    HOME=$PWD
  '';

  nativeBuildInputs = [ pkgs.beets ];

  dependencies = with python3.pkgs; [
    httpx
    ordered-set
    packaging
    pycountry
  ];

  pythonImportsCheck = [ "beetsplug.bandcamp" ];

  meta = {
    description = "Bandcamp autotagger source for beets (https://beets.io)";
    homepage = "https://github.com/snejus/beetcamp";
    changelog = "https://github.com/snejus/beetcamp/blob/${src.rev}/CHANGELOG.md";
    license = lib.licenses.gpl2Only;
    maintainers = [ ];
    mainProgram = "beetcamp";
  };
}

All sorted!

Re: The pythonCatchConflictsPhase / Found duplicated packages in closure for dependency 'beets' error: