System/applications/media.nix

149 lines
3.3 KiB
Nix
Raw Normal View History

2021-12-20 13:37:26 -05:00
# Media players and other applications
2022-01-31 22:34:32 -05:00
{ config, pkgs, lib, unstable, ... }:
let
mopidyEnv = pkgs.buildEnv {
name = "mopidy-daemon-environment";
paths = with pkgs; [
mopidy-mpd
mopidy-iris
mopidy-scrobbler
2022-02-07 11:54:38 -05:00
mopidy-local
2022-01-31 22:34:32 -05:00
];
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
'';
};
2022-02-03 07:02:26 -05:00
mopidyConf = pkgs.writeText "mopidy.conf"
''
[core]
#cache_dir = $XDG_CACHE_DIR/mopidy
#config_dir = $XDG_CONFIG_DIR/mopidy
#data_dir = $XDG_DATA_DIR/mopidy
#max_tracklist_length = 10000
#restore_state = false
[logging]
#verbosity = 0
#format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
#color = true
#config_file =
[audio]
#mixer = software
#mixer_volume =
#output = autoaudiosink
#buffer_time =
[proxy]
#scheme =
#hostname =
#port =
#username =
#password =
[file]
enabled = true
media_dirs =
~/Music
# $XDG_MUSIC_DIR|Music
#excluded_file_extensions =
# .directory
# .html
# .jpeg
# .jpg
# .log
# .nfo
# .pdf
# .png
# .txt
# .zip
#show_dotfiles = false
#follow_symlinks = false
#metadata_timeout = 1000
2022-02-07 11:54:38 -05:00
[local]
media_dir = /home/nathan/Music
2022-02-03 07:02:26 -05:00
[http]
#enabled = true
#hostname = 127.0.0.1
#port = 6680
#zeroconf = Mopidy HTTP server on $hostname
#allowed_origins =
#csrf_protection = true
#default_app = mopidy
[m3u]
#enabled = true
#base_dir = $XDG_MUSIC_DIR
#default_encoding = latin-1
#default_extension = .m3u8
#playlists_dir =
[softwaremixer]
#enabled = true
[stream]
#enabled = true
#protocols =
# http
# https
# mms
# rtmp
# rtmps
# rtsp
#metadata_blacklist =
#timeout = 5000
[mpd]
enabled = true
'';
2022-01-31 22:34:32 -05:00
in
2021-12-20 13:37:26 -05:00
{
environment.systemPackages = with pkgs; [
# Spotify
spotify
# Latest version of vlc
unstable.vlc
# Plex client
plex-media-player
# OBS studio for screen recording
unstable.obs-studio
2022-01-31 15:40:53 -05:00
# Soulseek client
nicotine-plus
2022-01-31 22:34:32 -05:00
# Mopidy + extensions
mopidy
2022-02-07 11:54:38 -05:00
mopidy-mpd
mopidy-iris
mopidy-scrobbler
mopidy-local
2022-02-01 00:21:11 -05:00
# Picard for sorting
unstable.picard
2021-12-20 13:37:26 -05:00
];
2022-01-31 18:04:46 -05:00
2022-01-31 22:34:32 -05:00
# Start mopidy as a user service, for sanity
systemd.user.services.mopidy = {
description = "Mopidy music server";
2022-02-03 07:02:26 -05:00
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
2022-01-31 22:34:32 -05:00
serviceConfig = {
2022-02-03 07:02:26 -05:00
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" [mopidyConf config.sops.secrets.lastfm-conf.path]}";
2022-01-31 22:34:32 -05:00
};
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" ];
};
2021-12-20 13:37:26 -05:00
}