about summary refs log tree commit diff stats
path: root/modules/by-name/mp/mpd/mpc.nix
blob: 5fbeddc5d14d4fcbbce0e56d4105e23c763783b9 (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
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.soispha.services.mpd.mpc;

  mpp = pkgs.mpp.override {
    # Removes the currently playing song from the disk and storage
    mpp-beetrm = pkgs.mpp-beetrm.override {
      beets = cfg.beetsPkg;
    };

    # Works like normal `mpc searchadd` but uses the `beets` query syntax
    mpp-searchadd = pkgs.mpp-searchadd.override {
      beets = cfg.beetsPkg;
    };
  };
in {
  options.soispha.services.mpd.mpc = {
    enable = lib.mkEnableOption "mpc with extensions";

    mppPackage = lib.mkOption {
      type = lib.types.package;
      description = "The package to use, when calling `mpp`";
      default = mpp;
    };

    beetsPkg = lib.mkOption {
      type = lib.types.package;
      description = "The package to use, when calling `beet`";
    };
  };

  config = lib.mkIf cfg.enable {
    home-manager.users.soispha.home.packages = [
      # Wrapper around `mpc` that allows the usage of `mpc-{beetsrm,lyrics,searchadd}`
      cfg.mppPackage
    ];
  };
}