mirror of
https://github.com/nix-community/home-manager
synced 2024-12-28 20:59:47 +01:00
listenbrainz-mpd: add module
This commit is contained in:
parent
e386ec640e
commit
e60080ddfb
4 changed files with 62 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -440,6 +440,8 @@ Makefile @thiagokokada
|
|||
|
||||
/modules/services/lieer.nix @tadfisher
|
||||
|
||||
/modules/services/listenbrainz-mpd.nix @Scrumplex
|
||||
|
||||
/modules/services/lorri.nix @Gerschtli
|
||||
|
||||
/modules/services/mako.nix @onny
|
||||
|
|
|
@ -948,6 +948,14 @@ in
|
|||
'programs.i3status-rust.package' to an older version.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2023-03-22T07:20:00+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.listenbrainz-mpd'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ let
|
|||
./services/keybase.nix
|
||||
./services/keynav.nix
|
||||
./services/lieer.nix
|
||||
./services/listenbrainz-mpd.nix
|
||||
./services/lorri.nix
|
||||
./services/mako.nix
|
||||
./services/mbsync.nix
|
||||
|
|
51
modules/services/listenbrainz-mpd.nix
Normal file
51
modules/services/listenbrainz-mpd.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
inherit (lib.options) mkEnableOption mkPackageOption mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.services.listenbrainz-mpd;
|
||||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ lib.maintainers.Scrumplex ];
|
||||
|
||||
options.services.listenbrainz-mpd = {
|
||||
enable = mkEnableOption "listenbrainz-mpd";
|
||||
|
||||
package = mkPackageOption pkgs "listenbrainz-mpd" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration for listenbrainz-mpd written to
|
||||
<filename>$XDG_CONFIG_HOME/listenbrainz-mpd/config.toml</filename>.
|
||||
'';
|
||||
example = { submission.tokenFile = "/run/secrets/listenbrainz-mpd"; };
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services."listenbrainz-mpd" = {
|
||||
Unit = {
|
||||
Description = "ListenBrainz submission client for MPD";
|
||||
Documentation = "https://codeberg.org/elomatreb/listenbrainz-mpd";
|
||||
After = [ "mpd.service" ];
|
||||
Requires = [ "mpd.service" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${cfg.package}/bin/listenbrainz-mpd";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
xdg.configFile."listenbrainz-mpd/config.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "listenbrainz-mpd.toml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue