From 79025026cbb8fea731fd76b665b519bda4d76a85 Mon Sep 17 00:00:00 2001 From: Sergey Zubkov Date: Wed, 8 Nov 2023 21:58:00 +0300 Subject: [PATCH] connect mpd to piperwire --- flake.lock | 12 ++++++------ hosts/hk47.nix | 1 - hosts/laundry.nix | 16 +++++++--------- hosts/pepes.nix | 1 - hosts/tv.nix | 1 - services/mpd.nix | 20 +++++++++++++------- users/ksevelyar.nix | 1 + 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index 363b1df..ad376a2 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1696940889, - "narHash": "sha256-p2Wic74A1tZpFcld1wSEbFQQbrZ/tPDuLieCnspamQo=", + "lastModified": 1699368917, + "narHash": "sha256-nUtGIWf86BOkUbtksWtfglvCZ/otP0FTZlQH8Rzc7PA=", "owner": "rycee", "repo": "home-manager", - "rev": "6bba64781e4b7c1f91a733583defbd3e46b49408", + "rev": "6a8444467c83c961e2f5ff64fb4f422e303c98d3", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1699099776, + "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", "type": "github" }, "original": { diff --git a/hosts/hk47.nix b/hosts/hk47.nix index 4910555..3a05003 100644 --- a/hosts/hk47.nix +++ b/hosts/hk47.nix @@ -45,7 +45,6 @@ args@{ config, lib, pkgs, ... }: ../services/journald.nix ../services/databases/postgresql.nix ../services/databases/redis.nix - ../services/mpd.nix ../services/x.nix ../services/x/picom.nix ../services/x/redshift.nix diff --git a/hosts/laundry.nix b/hosts/laundry.nix index 64caac8..c542ab1 100644 --- a/hosts/laundry.nix +++ b/hosts/laundry.nix @@ -10,8 +10,8 @@ args@{ config, lib, pkgs, ... }: ../hardware/bluetooth.nix ../hardware/mouse.nix ../hardware/intel-cpu.nix - # ../hardware/pipeware.nix - ../hardware/pulseaudio.nix + ../hardware/pipeware.nix + # ../hardware/pulseaudio.nix ../hardware/ssd.nix (import ../hardware/power-management.nix ({ pkgs = pkgs; battery = "BAT1"; })) @@ -38,7 +38,6 @@ args@{ config, lib, pkgs, ... }: ../services/journald.nix ../services/databases/postgresql.nix ../services/databases/redis.nix - ../services/mpd.nix ../services/x.nix ../services/x/picom.nix ../services/x/redshift.nix @@ -71,12 +70,11 @@ args@{ config, lib, pkgs, ... }: express.autoStart = false; }; - # environment.systemPackages = with pkgs; [ - # vmpk - # qsynth - # qjackctl - # ]; - + environment.systemPackages = with pkgs; [ + vmpk + qsynth + qjackctl + ]; # microbit v2 services.udev.extraRules = '' SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE:="666" diff --git a/hosts/pepes.nix b/hosts/pepes.nix index 6c410c3..c9db5e9 100644 --- a/hosts/pepes.nix +++ b/hosts/pepes.nix @@ -50,7 +50,6 @@ ../services/vpn.nix ../services/net/avahi.nix - # ../services/mpd.nix # ../services/vm/hypervisor.nix ]; diff --git a/hosts/tv.nix b/hosts/tv.nix index 66f9332..b380bf6 100644 --- a/hosts/tv.nix +++ b/hosts/tv.nix @@ -30,7 +30,6 @@ args@{ config, lib, pkgs, ... }: ../packages/pass.nix ../packages/tmux.nix - ../services/mpd.nix ../services/journald.nix ../services/x.nix ../services/x/redshift.nix diff --git a/services/mpd.nix b/services/mpd.nix index c706bf9..f12fc5b 100644 --- a/services/mpd.nix +++ b/services/mpd.nix @@ -1,13 +1,19 @@ -{ pkgs, ... }: +{ pkgs, user, ... }: { - hardware.pulseaudio.extraConfig = "load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1"; + services.mpd.user = user; + systemd.services.mpd.environment = { + # https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609 + # User-id 1000 must match above user. MPD will look inside this directory for the PipeWire socket. + XDG_RUNTIME_DIR = "/run/user/1000"; + }; + services.mpd = { enable = true; - musicDirectory = "/data/music"; # https://www.off-the-beat.com/flac-vs-mp3/ + musicDirectory = "/data/music"; extraConfig = '' audio_output { - type "pulse" - name "pulse" + type "pipewire" + name "pipewire" server "127.0.0.1" } @@ -32,12 +38,12 @@ # fetch metadata ## https://picard-docs.musicbrainz.org/en/tutorials/acoustid.html - # rename files with picard name script `%artist% - %title%` + # rename files with picard name script `%artist% - %title%` ## https://picard-docs.musicbrainz.org/en/config/options_filerenaming_editor.html picard flac # metaflac --list (fzf) - # downcase dirs + # downcase dirs mmv # mmv '*' '#l1' ]; diff --git a/users/ksevelyar.nix b/users/ksevelyar.nix index afd3cd6..3b2e09f 100644 --- a/users/ksevelyar.nix +++ b/users/ksevelyar.nix @@ -7,6 +7,7 @@ in { imports = [ (import ./shared.nix (args // { user = user; email = email; name = name; })) + (import ../services/mpd.nix (args // { user = user; })) (import ../services/mpd/mpdscribble.nix (args // { user = user; listenbrainz_user = user; })) ] ++ [ (lib.mkIf (config.services.xserver.enable) (import ../services/x/polybar.nix (args // { user = user; })))