From 644d517cac8375e73282c790901975447a79a9de Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 27 Jul 2021 18:12:19 +0300 Subject: [PATCH] Add back mopidy --- profiles/hardware.nix | 32 +++++++++++++++++++++++++++----- profiles/overlay.nix | 22 ++++++++++++++++++++++ profiles/workspace/mopidy.nix | 27 +++++++++++++++++++++++++++ roles/desktop.nix | 1 + 4 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 profiles/workspace/mopidy.nix diff --git a/profiles/hardware.nix b/profiles/hardware.nix index e3265e0..4e859b1 100644 --- a/profiles/hardware.nix +++ b/profiles/hardware.nix @@ -14,13 +14,9 @@ with deviceSpecific; { persist.state.directories = [ "/var/lib/bluetooth" ]; - systemd.services.systemd-udev-settle.enable = false; - services.upower = { - enable = true; - }; - + services.upower = { enable = true; }; services.logind.lidSwitchExternalPower = "ignore"; @@ -34,6 +30,32 @@ with deviceSpecific; { enable = true; alsa.enable = true; pulse.enable = true; + config.pipewire-pulse = { + "context.modules" = [ + { + "args" = { }; + "flags" = [ "ifexists" "nofail" ]; + "name" = "libpipewire-module-rtkit"; + } + { "name" = "libpipewire-module-protocol-native"; } + { "name" = "libpipewire-module-client-node"; } + { "name" = "libpipewire-module-adapter"; } + { "name" = "libpipewire-module-metadata"; } + { + "args" = { + "server.address" = [ "unix =native" "tcp:4713" ]; + "vm.overrides" = { "pulse.min.quantum" = "1024/48000"; }; + }; + "name" = "libpipewire-module-protocol-pulse"; + } + ]; + "context.properties" = { }; + "context.spa-libs" = { + "audio.convert.*" = "audioconvert/libspa-audioconvert"; + "support.*" = "support/libspa-support"; + }; + "stream.properties" = { }; + }; media-session.config.bluez-monitor = { properties = { "bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ]; diff --git a/profiles/overlay.nix b/profiles/overlay.nix index 7b442f7..967fcd3 100644 --- a/profiles/overlay.nix +++ b/profiles/overlay.nix @@ -80,6 +80,28 @@ in { nurpkgs = pkgs; }).repos; + mopidy-ytmusic = with pkgs; + python3Packages.buildPythonApplication rec { + pname = "mopidy-ytmusic"; + version = "3.2"; + + src = fetchFromGitHub { + owner = "ozymandiasthegreat"; + repo = "mopidy-ytmusic"; + rev = "2a7d8ec7f7161e5ca81e999786ea7c1f4da9205f"; + sha256 = "hDOP0AR9P0sQHeW7JmG+yZf/w5mZrIu4Nl4xCMjQaIQ="; + fetchSubmodules = true; + }; + + propagatedBuildInputs = [ + mopidy + python3Packages.pytube + python3Packages.ytmusicapi + ]; + + doCheck = false; + }; + inherit (nur.balsoft.pkgs) termNote nix-patch; lambda-launcher = inputs.lambda-launcher.defaultPackage.${system}; diff --git a/profiles/workspace/mopidy.nix b/profiles/workspace/mopidy.nix new file mode 100644 index 0000000..2320d73 --- /dev/null +++ b/profiles/workspace/mopidy.nix @@ -0,0 +1,27 @@ +{ pkgs, config, lib, ... }: +{ + secrets.mopidy_ytmusic_auth = { + owner = "mopidy:mopidy"; + services = [ "mopidy" ]; + }; + + services.mopidy = { + enable = true; + extensionPackages = with pkgs; [ mopidy-mpd mopidy-ytmusic ]; + configuration = '' + [ytmusic] + enabled=true + auth_json=${config.secrets.mopidy_ytmusic_auth.decrypted} + [mpd] + hostname = 0.0.0.0 + port = 6600 + [audio] + output = pulsesink server=127.0.0.1 + ''; + }; + + systemd.services.mopidy = { + after = [ "network-online.target" ]; + }; + +} diff --git a/roles/desktop.nix b/roles/desktop.nix index 59ac404..21f841f 100644 --- a/roles/desktop.nix +++ b/roles/desktop.nix @@ -31,6 +31,7 @@ kde light mako + mopidy simple-osd-daemons sway ];