164 lines
3.8 KiB
Nix
164 lines
3.8 KiB
Nix
# Media players and other applications
|
|
{ config, pkgs, lib, unstable, ... }:
|
|
let
|
|
mopidyEnv = pkgs.buildEnv {
|
|
name = "mopidy-daemon-environment";
|
|
paths = with pkgs; [
|
|
mopidy-mpd
|
|
mopidy-iris
|
|
mopidy-scrobbler
|
|
mopidy-local
|
|
];
|
|
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
postBuild = ''
|
|
makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \
|
|
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
|
|
'';
|
|
};
|
|
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
|
|
|
|
[local]
|
|
media_dir = /home/nathan/Music
|
|
|
|
[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
|
|
'';
|
|
in
|
|
{
|
|
environment.systemPackages =
|
|
let
|
|
## Wrapper around iris
|
|
irisDesktopItem = pkgs.makeDesktopItem {
|
|
name = "iris";
|
|
desktopName = "Iris";
|
|
exec = "${pkgs.chromium}/bin/chromium --enable-features=UseOzonePlatform -ozone-platform=wayland --app=\"http://localhost:6680/iris/\"";
|
|
terminal = false;
|
|
};
|
|
in
|
|
with pkgs; [
|
|
# Spotify
|
|
spotify
|
|
# Latest version of vlc
|
|
unstable.vlc
|
|
# Plex client
|
|
plex-media-player
|
|
# OBS studio for screen recording
|
|
unstable.obs-studio
|
|
# Soulseek client
|
|
nicotine-plus
|
|
# Mopidy + extensions
|
|
mopidyEnv
|
|
# Iris desktop client
|
|
irisDesktopItem
|
|
# Picard for sorting
|
|
unstable.picard
|
|
];
|
|
|
|
# Start mopidy as a user service, for sanity
|
|
systemd.user.services.mopidy = {
|
|
description = "Mopidy music server";
|
|
wantedBy = [ "graphical-session.target" ];
|
|
partOf = [ "graphical-session.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" [mopidyConf config.sops.secrets.lastfm-conf.path]}";
|
|
};
|
|
wants = [ "rclone-music.service" ];
|
|
enable = true;
|
|
};
|
|
# Load up lastfm scrobbling secret
|
|
sops.secrets.lastfm-conf = {
|
|
owner = "nathan";
|
|
format = "binary";
|
|
sopsFile = ../secrets/lastfm.conf;
|
|
};
|
|
|
|
# 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" ];
|
|
};
|
|
|
|
}
|