summary refs log tree commit diff
path: root/pkgs/tools/audio/beets/default.nix
blob: c6b99978fe38a7dfeffb586ad34a741e73795823 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{ lib
, callPackage
, fetchFromGitHub
, fetchpatch
, python3Packages
}:
/*
** To customize the enabled beets plugins, use the pluginOverrides input to the
** derivation.
** Examples:
**
** Disabling a builtin plugin:
** beets.override { pluginOverrides = { beatport.enable = false; }; }
**
** Enabling an external plugin:
** beets.override { pluginOverrides = {
**   alternatives = { enable = true; propagatedBuildInputs = [ beetsPackages.alternatives ]; };
** }; }
*/
lib.makeExtensible (self: {
  beets = self.beets-stable;

  beets-stable = callPackage ./common.nix rec {
    inherit python3Packages;
    version = "1.6.0";
    src = fetchFromGitHub {
      owner = "beetbox";
      repo = "beets";
      rev = "v${version}";
      hash = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM=";
    };
    extraPatches = [
      # Bash completion fix for Nix
      ./patches/bash-completion-always-print.patch

      # Fix unidecode>=1.3.5 compat
      (fetchpatch {
        url = "https://github.com/beetbox/beets/commit/5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9.patch";
        hash = "sha256-gqkrE+U1j3tt1qPRJufTGS/GftaSw/gweXunO/mCVG8=";
      })

      # Fix embedart with ImageMagick 7.1.1-12
      # https://github.com/beetbox/beets/pull/4839
      # The upstream patch does not apply on 1.6.0, as the related code has been refactored since
      ./patches/fix-embedart-imagick-7.1.1-12.patch
      # Pillow 10 compatibility fix, a backport of
      # https://github.com/beetbox/beets/pull/4868, which doesn't apply now
      ./patches/fix-pillow10-compat.patch
    ];
    disabledTests = [
      # This issue is present on this version alone, and can be removed on the
      # next stable version version bump. Since this is fixed in branch master,
      # we don't have a bug ticket open for this. As of writing, it also seems
      # hard to find a patch that can be backported to v1.6.0 that would fix
      # the failure, as the master branch has gone through too many changes
      # now.
      "test_get_single_item_by_path"
    ];
  };

  beets-minimal = self.beets.override { disableAllPlugins = true; };

  beets-unstable = callPackage ./common.nix {
    inherit python3Packages;
    version = "unstable-2023-07-05";
    src = fetchFromGitHub {
      owner = "beetbox";
      repo = "beets";
      rev = "9481402b3c20739ca0b879d19adbfca22ccd6a44";
      hash = "sha256-AKmozMNVchysoQcUWd90Ic6bQBKQgylVn0E3i85dGb8=";
    };
    extraPatches = [
      # Bash completion fix for Nix
      ./patches/unstable-bash-completion-always-print.patch
      # Pillow 10 compatibility fix, see:
      # https://github.com/beetbox/beets/pull/4868
      (fetchpatch {
        url = "https://github.com/beetbox/beets/commit/c2118a8b9cd8c9c91135c6e178830b89b40867be.patch";
        hash = "sha256-HWf940WrF10Jnu9iyoHovFDcvj9LY8p7zIlJg1TfKxQ=";
        # Doesn't apply on this file, and it we don't care.
        excludes = [ "docs/changelog.rst" ];
      })
    ];
    pluginOverrides = {
      # unstable has a new plugin, so we register it here.
      limit = { builtin = true; };
    };
  };

  alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; };
  copyartifacts = callPackage ./plugins/copyartifacts.nix { beets = self.beets-minimal; };
  extrafiles = callPackage ./plugins/extrafiles.nix { beets = self.beets-minimal; };
})