Install and activate external plugin for beets

I really don’t know what I’m doing here. I want to install the copy-artifacts plugin but there’s errors all over the place.

Here’s the relevant part on .config/nixpkgs/config.nix:

{
beets.enableCopyArtifacts = true;
}

(mind you, I don’t know how to apply this config. how do you do it? right now I’m just installing beets again “nix-env -iA nixos.beets”)

Then I run beet:

** error loading plugin copyartifacts:
Traceback (most recent call last):
  File "/nix/store/1ayx4hnj3y863xcyssl63fymrpp35xv9-beets-1.4.9/lib/python3.8/site-packages/beets/plugins.py", line 273, in load_plugins
    namespace = __import__(modname, None, None)
ModuleNotFoundError: No module named 'beetsplug.copyartifacts'

And so on. The plugin still isn’t in “.nix-profile/lib/python3.8/site-packages/beetsplug/copyartifacts.py” so I have to install it still.

I figured out I can then install the plugin by doing “nix-env -iA nixos.beets.externalPlugins.copyartifacts” but there’s a conflict:

installing 'beets-copyartifacts'
building '/nix/store/mh2sdy39xmq453jfn6g63p09vkydsfgl-user-environment.drv'...
error: packages '/nix/store/a9r03fh471wnz9ipw2yp8vd2rr10i45g-beets-copyartifacts/lib/python3.8/site-packages/beetsplug/__init__.py' and '/nix/store/1ayx4hnj3y863xcyssl63fymrpp35xv9-beets-1.4.9/lib/python3.8/site-packages/beetsplug/__init__.py' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/mh2sdy39xmq453jfn6g63p09vkydsfgl-user-environment.drv' failed with exit code 1
error: build of '/nix/store/mh2sdy39xmq453jfn6g63p09vkydsfgl-user-environment.drv' failed

So I set the priority “nix-env --set-flag priority 0 beets”

setting flag on 'beets-1.4.9'
building '/nix/store/dw4m7gg3j5kg1x3lfb7vz1kjmm1d4nga-user-environment.drv'...
created 1554 symlinks in user environment

then install “nix-env -iA nixos.beets.externalPlugins.copyartifacts” and the plugin appears in “.nix-profile/lib/python3.8/”.

But then I run “beet”:

** error loading plugin copyartifacts:                                             
Traceback (most recent call last):                                                 
  File "/nix/store/1ayx4hnj3y863xcyssl63fymrpp35xv9-beets-1.4.9/lib/python3.8/site-packages/beets/plugins.py", line 273, in load_plugins
    namespace = __import__(modname, None, None)
ModuleNotFoundError: No module named 'beetsplug.copyartifacts'

So what am I doing wrong?

1 Like

I think because there are no dedicated NixOS options for Beets, you’d have to do an override.

OK, that was it, thank you!

Here’s my .config/nixpkgs/config.nix snippet for whoever needs it:

packageOverrides = pkgs: {
  beets-plus-ca = pkgs.beets.override {
    enableCopyArtifacts = true;
  };

Then install the custom package name:
nix-env -iA beets-plus-ca
(this will compile beets from scratch)

The option enableCopyArtifacts comes from the nix file for beets. There’s two other external plugins defined there.