nixos/mopidy: remove "with" statment
This commit is contained in:
parent
af6f9b7aa8
commit
fba9ba64b3
@ -1,24 +1,20 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
with lib;
|
||||
|
||||
let
|
||||
uid = config.ids.uids.mopidy;
|
||||
gid = config.ids.gids.mopidy;
|
||||
cfg = config.services.mopidy;
|
||||
|
||||
mopidyConf = writeText "mopidy.conf" cfg.configuration;
|
||||
mopidyConf = pkgs.writeText "mopidy.conf" cfg.configuration;
|
||||
|
||||
mopidyEnv = buildEnv {
|
||||
name = "mopidy-with-extensions-${mopidy.version}";
|
||||
mopidyEnv = pkgs.buildEnv {
|
||||
name = "mopidy-with-extensions-${pkgs.mopidy.version}";
|
||||
ignoreCollisions = true;
|
||||
paths = closePropagation cfg.extensionPackages;
|
||||
pathsToLink = [ "/${mopidyPackages.python.sitePackages}" ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
paths = lib.closePropagation cfg.extensionPackages;
|
||||
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
makeWrapper ${mopidy}/bin/mopidy $out/bin/mopidy \
|
||||
--prefix PYTHONPATH : $out/${mopidyPackages.python.sitePackages}
|
||||
makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \
|
||||
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
|
||||
'';
|
||||
};
|
||||
in {
|
||||
@ -27,49 +23,47 @@ in {
|
||||
|
||||
services.mopidy = {
|
||||
|
||||
enable = mkEnableOption "Mopidy, a music player daemon";
|
||||
enable = lib.mkEnableOption "Mopidy, a music player daemon";
|
||||
|
||||
dataDir = mkOption {
|
||||
dataDir = lib.mkOption {
|
||||
default = "/var/lib/mopidy";
|
||||
type = types.str;
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The directory where Mopidy stores its state.
|
||||
'';
|
||||
};
|
||||
|
||||
extensionPackages = mkOption {
|
||||
extensionPackages = lib.mkOption {
|
||||
default = [];
|
||||
type = types.listOf types.package;
|
||||
example = literalExpression "[ pkgs.mopidy-spotify ]";
|
||||
type = lib.types.listOf lib.types.package;
|
||||
example = lib.literalExpression "[ pkgs.mopidy-spotify ]";
|
||||
description = ''
|
||||
Mopidy extensions that should be loaded by the service.
|
||||
'';
|
||||
};
|
||||
|
||||
configuration = mkOption {
|
||||
configuration = lib.mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
type = lib.types.lines;
|
||||
description = ''
|
||||
The configuration that Mopidy should use.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfigFiles = mkOption {
|
||||
extraConfigFiles = lib.mkOption {
|
||||
default = [];
|
||||
type = types.listOf types.str;
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = ''
|
||||
Extra config file read by Mopidy when the service starts.
|
||||
Later files in the list overrides earlier configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
systemd.tmpfiles.settings."10-mopidy".${cfg.dataDir}.d = {
|
||||
user = "mopidy";
|
||||
@ -82,7 +76,7 @@ in {
|
||||
wants = [ "network-online.target" ];
|
||||
description = "mopidy music player daemon";
|
||||
serviceConfig = {
|
||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
|
||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
|
||||
User = "mopidy";
|
||||
};
|
||||
};
|
||||
@ -90,7 +84,7 @@ in {
|
||||
systemd.services.mopidy-scan = {
|
||||
description = "mopidy local files scanner";
|
||||
serviceConfig = {
|
||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
|
||||
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
|
||||
User = "mopidy";
|
||||
Type = "oneshot";
|
||||
};
|
||||
@ -105,7 +99,5 @@ in {
|
||||
};
|
||||
|
||||
users.groups.mopidy.gid = gid;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user