1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

mpd-discord-rpc: init service (#2728)

This commit is contained in:
Ilan Joselevich 2022-04-05 06:48:13 +03:00 committed by GitHub
parent 399a3dfeaf
commit 07b941f0c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -340,6 +340,8 @@
/modules/services/mpdris2.nix @pjones /modules/services/mpdris2.nix @pjones
/modules/services/mpd-discord-rpc.nix @Kranzes
/modules/services/mpris-proxy.nix @ThibautMarty /modules/services/mpris-proxy.nix @ThibautMarty
/modules/services/muchsync.nix @pacien /modules/services/muchsync.nix @pacien

View file

@ -209,6 +209,7 @@ let
./services/mbsync.nix ./services/mbsync.nix
./services/mpd.nix ./services/mpd.nix
./services/mpdris2.nix ./services/mpdris2.nix
./services/mpd-discord-rpc.nix
./services/mpris-proxy.nix ./services/mpris-proxy.nix
./services/muchsync.nix ./services/muchsync.nix
./services/network-manager-applet.nix ./services/network-manager-applet.nix

View 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" ];
};
};
}