mirror of
https://git.oat.zone/dark-firepit/dotfiles
synced 2024-11-30 11:41:33 +01:00
53 lines
909 B
Nix
53 lines
909 B
Nix
{ config, lib, pkgs, options, ... }:
|
|
|
|
with lib;
|
|
let
|
|
audioSupport = config.modules.hardware.audio.enable;
|
|
cfg = config.modules.services.mpd;
|
|
|
|
in {
|
|
options.modules.services.mpd = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
description = "Which user MPD should run on";
|
|
};
|
|
|
|
musicDir = mkOption {
|
|
type = types.str;
|
|
defaultText = "$XDG_MUSIC_DIR";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.mpd = {
|
|
enable = true;
|
|
user = cfg.user;
|
|
};
|
|
|
|
home._.services.mpd = {
|
|
enable = true;
|
|
musicDirectory = cfg.musicDir;
|
|
extraConfig =
|
|
''
|
|
zeroconf_enabled "no"
|
|
restore_paused "yes"
|
|
replaygain "track"
|
|
''
|
|
+ (if audioSupport then
|
|
''
|
|
audio_output {
|
|
type "pipewire"
|
|
name "PipeWire Audio Server"
|
|
server "127.0.0.1"
|
|
}
|
|
'' else "");
|
|
};
|
|
};
|
|
}
|