Add mopidy

This commit is contained in:
Nathan McCarty 2022-01-31 22:34:32 -05:00
parent 2bee56b0cb
commit dce30b4aa6
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
1 changed files with 39 additions and 2 deletions

View File

@ -1,7 +1,22 @@
# Media players and other applications
{ config, pkgs, unstable, ... }:
{ config, pkgs, lib, unstable, ... }:
let
mopidyEnv = pkgs.buildEnv {
name = "mopidy-daemon-environment";
paths = with pkgs; [
mopidy-mpd
mopidy-iris
mopidy-scrobbler
];
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
'';
};
in
{
# imports = [ ../../sensitive/mopidy.nix ];
environment.systemPackages = with pkgs; [
# Spotify
spotify
@ -13,6 +28,8 @@
unstable.obs-studio
# Soulseek client
nicotine-plus
# Mopidy + extensions
mopidy
];
# Mount music directory
@ -26,4 +43,24 @@
};
enable = true;
};
# Start mopidy as a user service, for sanity
systemd.user.services.mopidy = {
description = "Mopidy music server";
serviceConfig = {
ExecStart = "${mopidyEnv}/bin/mopidy";
};
wants = [ "rclone-music.service" ];
enable = true;
};
# Same for the scanning service
systemd.user.services.mopidy-scan = {
description = "Mopidy files local scanner";
serviceConfig = {
ExecStart = "${mopidyEnv}/bin/mopidy local scan";
Type = "oneshot";
};
wants = [ "rclone-music.service" ];
};
}