home/mpd: create dirs before startup, runtimedir, tmpfiles

This commit is contained in:
2025-04-02 12:53:56 +02:00
parent faaebbedca
commit 123bb9a769

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.services.mpd; cfg = config.services.mpd;
runtimeDir = "/run/user/${toString config.home.uid}/mpd";
in in
{ {
services.mpd = { services.mpd = {
@ -12,7 +13,7 @@ in
autoUpdateDatabase = true; autoUpdateDatabase = true;
extraConfig = '' extraConfig = ''
pid_file "/run/user/${toString config.home.uid}/mpd/pid" pid_file "${runtimeDir}/pid"
zeroconf_enabled "no" zeroconf_enabled "no"
@ -30,7 +31,7 @@ in
audio_output { audio_output {
type "fifo" type "fifo"
name "Visualizer feed" name "Visualizer feed"
path "/run/user/${toString config.home.uid}/mpd/visualizer.fifo" path "${runtimeDir}/visualizer.fifo"
format "44100:16:2" format "44100:16:2"
} }
@ -95,7 +96,12 @@ in
"AF_UNIX" "AF_UNIX"
]; ];
RestrictNamespaces = true; RestrictNamespaces = true;
RuntimeDirectory = "mpd";
}; };
}; };
systemd.user.tmpfiles.rules = [
"d ${cfg.dataDir} - ${config.home.username} - - -"
];
} }