mpd-discord-rpc: init service (#2728)
This commit is contained in:
parent
399a3dfeaf
commit
07b941f0c4
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -340,6 +340,8 @@
|
|||
|
||||
/modules/services/mpdris2.nix @pjones
|
||||
|
||||
/modules/services/mpd-discord-rpc.nix @Kranzes
|
||||
|
||||
/modules/services/mpris-proxy.nix @ThibautMarty
|
||||
|
||||
/modules/services/muchsync.nix @pacien
|
||||
|
|
|
@ -209,6 +209,7 @@ let
|
|||
./services/mbsync.nix
|
||||
./services/mpd.nix
|
||||
./services/mpdris2.nix
|
||||
./services/mpd-discord-rpc.nix
|
||||
./services/mpris-proxy.nix
|
||||
./services/muchsync.nix
|
||||
./services/network-manager-applet.nix
|
||||
|
|
55
modules/services/mpd-discord-rpc.nix
Normal file
55
modules/services/mpd-discord-rpc.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mpd-discord-rpc;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
configFile = tomlFormat.generate "config.toml" cfg.settings;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.kranzes ];
|
||||
|
||||
options.services.mpd-discord-rpc = {
|
||||
enable = mkEnableOption "the mpd-discord-rpc service";
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
hosts = [ "localhost:6600" ];
|
||||
format = {
|
||||
details = "$title";
|
||||
state = "On $album by $artist";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration included in <literal>config.toml</literal>.
|
||||
For available options see <link xlink:href="https://github.com/JakeStanger/mpd-discord-rpc#configuration"/>
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.mpd-discord-rpc;
|
||||
defaultText = literalExpression "pkgs.mpd-discord-rpc";
|
||||
description = "mpd-discord-rpc package to use.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
xdg.configFile."discord-rpc/config.toml".source = configFile;
|
||||
|
||||
systemd.user.services.mpd-discord-rpc = {
|
||||
Unit = {
|
||||
Description = "Discord Rich Presence for MPD";
|
||||
Documentation = "https://github.com/JakeStanger/mpd-discord-rpc";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.desktop" ];
|
||||
};
|
||||
Service.ExecStart = "${cfg.package}/bin/mpd-discord-rpc";
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue