diff --git a/nixos/modules/services/audio/mopidy.nix b/nixos/modules/services/audio/mopidy.nix index a7a7e8ae688b..9981b065f28d 100644 --- a/nixos/modules/services/audio/mopidy.nix +++ b/nixos/modules/services/audio/mopidy.nix @@ -11,17 +11,8 @@ let mopidyConf = writeText "mopidy.conf" cfg.configuration; - mopidyLauncher = stdenv.mkDerivation { - name = "mopidy-launcher"; - phases = [ "installPhase" ]; - buildInputs = [ makeWrapper python ]; - installPhase = '' - mkdir -p $out/bin - ln -s ${mopidy}/bin/mopidy $out/bin/mopidy - wrapProgram $out/bin/mopidy \ - --prefix PYTHONPATH : \ - "${concatStringsSep ":" (map (p: "$(toPythonPath ${p})") cfg.extensionPackages)}" - ''; + mopidyEnv = python.buildEnv.override { + extraLibs = [ mopidy ] ++ cfg.extensionPackages; }; in { @@ -86,7 +77,7 @@ in { description = "mopidy music player daemon"; preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}"; serviceConfig = { - ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}"; + ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}"; User = "mopidy"; PermissionsStartOnly = true; }; @@ -96,7 +87,7 @@ in { description = "mopidy local files scanner"; preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}"; serviceConfig = { - ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan"; + ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan"; User = "mopidy"; PermissionsStartOnly = true; Type = "oneshot";