Unverified Commit 70f8cfe4 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

mopidy: migrate to rfc42 (#446598)

parents 1efc8e33 87897cae
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -4,12 +4,14 @@
  pkgs,
  ...
}:

let
  uid = config.ids.uids.mopidy;
  gid = config.ids.gids.mopidy;
  cfg = config.services.mopidy;
  settingsFormat = pkgs.formats.ini { };

  mopidyConf = pkgs.writeText "mopidy.conf" cfg.configuration;
  mopidyConf = settingsFormat.generate "mopidy.conf" cfg.settings;

  mopidyEnv = pkgs.buildEnv {
    name = "mopidy-with-extensions-${pkgs.mopidy.version}";
@@ -24,11 +26,14 @@ let
  };
in
{
  imports = [
    (lib.mkRemovedOptionModule [ "services" "mopidy" "configuration" ] ''
      Use RFC42-style services.mopidy.settings instead.
    '')
  ];

  options = {

    services.mopidy = {

      enable = lib.mkEnableOption "Mopidy, a music player daemon";

      dataDir = lib.mkOption {
@@ -48,11 +53,15 @@ in
        '';
      };

      configuration = lib.mkOption {
        default = "";
        type = lib.types.lines;
      settings = lib.mkOption {
        inherit (settingsFormat) type;
        example.mpd = {
          enabled = true;
          hostname = "::";
        };
        description = ''
          The configuration that Mopidy should use.
          See the upstream documentation <https://docs.mopidy.com/stable/config/> for details.
        '';
      };

@@ -67,8 +76,6 @@ in
    };
  };

  ###### implementation

  config = lib.mkIf cfg.enable {

    systemd.tmpfiles.settings."10-mopidy".${cfg.dataDir}.d = {