From e85c40310a7be9d89ec496c525be3a37638e8ce0 Mon Sep 17 00:00:00 2001 From: Mikael Voss Date: Mon, 26 Aug 2024 13:05:56 +0200 Subject: [PATCH] =?UTF-8?q?home:=20Re=E2=80=90enable=20music=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/config/nil/home.nix | 1 + home/config/nil/music.nix | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 home/config/nil/music.nix diff --git a/home/config/nil/home.nix b/home/config/nil/home.nix index afa29c4..6575202 100644 --- a/home/config/nil/home.nix +++ b/home/config/nil/home.nix @@ -23,6 +23,7 @@ in { ./sioyek.nix ./texlive.nix ./mpv.nix + ./music.nix ]; home.stateVersion = "24.11"; diff --git a/home/config/nil/music.nix b/home/config/nil/music.nix new file mode 100644 index 0000000..1a46d8f --- /dev/null +++ b/home/config/nil/music.nix @@ -0,0 +1,64 @@ +{ ... }: { config, lib, pkgs, ... }@args: +let + osConfig = args.osConfig or { }; + + systemctl = osConfig.systemd.package + /bin/systemctl; +in lib.mkIf (osConfig.hardware.graphics.enable or false) { + programs.beets = { + enable = true; + settings = { + directory = "~/msc"; + import.reflink = "auto"; + + plugins = [ + "chroma" + "spotify" + "fromfilename" + + "fetchart" + "lyrics" + "replaygain" + + "duplicates" + "hook" + ]; + + hook.hooks = [ + { + event = "import"; + command = "${systemctl} --user start mopidy-scan.service"; + } + ]; + }; + }; + + services.mopidy = { + enable = true; + extensionPackages = with pkgs; [ + mopidy-iris + mopidy-local + mopidy-mpd + mopidy-mpris + ]; + + settings = { + core = { + cache_dir = "$XDG_CACHE_DIR/mopidy"; + config_dir = "$XDG_CONFIG_DIR/mopidy"; + data_dir = "$XDG_DATA_DIR/mopidy"; + }; + + audio.mixer = "none"; + file.media_dirs = [ "$XDG_MUSIC_DIR" ]; + local.media_dir = "$XDG_MUSIC_DIR"; + + mpd.hostname = "localhost"; + + http = { + hostname = "localhost"; + port = 6680; + default_app = "iris"; + }; + }; + }; +}