summaryrefslogtreecommitdiff
path: root/nixos/modules/features/mpd/default.nix
blob: 383180df96cf651ed20efa8b91808ba56b0da7cb (plain)
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
{ pkgs, ... }:

{
  # MPD server
  services.mpd = {
    enable = true;
    user = "seraphim";
    openFirewall = false;
    settings = {
      music_directory = "/mnt/giga/music";
      bind_to_address = "any";
      port = 6600;
      auto_update = "yes";
      audio_output = [
        {
          type = "pulse";
          name = "PipeWire Output";
          mixer_type = "hardware";
        }
      ];
    };
  };

  systemd.services.mpd.environment = {
    XDG_RUNTIME_DIR = "/run/user/1000";
  };

  # mpd-mpris is the MPRIS bridge for MPD — only useful when MPD is on,
  # so it lives in the same feature. Disable by removing this block.
  systemd.user.services.mpd-mpris = {
    description = "MPD MPRIS Service for Waybar";
    wantedBy = [ "default.target" ];
    after = [ "graphical-session.target" ];
    serviceConfig = {
      ExecStart = "${pkgs.mpd-mpris}/bin/mpd-mpris -network tcp -host 127.0.0.1 -port 6600";
      Restart = "on-failure";
    };
  };
}