about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-06-27 17:54:14 +0200
committerSoispha <soispha@vhack.eu>2023-06-27 17:54:14 +0200
commiteb439ea06fa96bc3b8ed935a45d7eddb06a570c2 (patch)
tree2b23e5c351db7048731264c081e3f8aa13a834ed
parentFix(hm/conf/mpd): Set MPD_HOST variable for mpd clients (diff)
downloadnixos-config-eb439ea06fa96bc3b8ed935a45d7eddb06a570c2.tar.gz
nixos-config-eb439ea06fa96bc3b8ed935a45d7eddb06a570c2.zip
Fix(hm/conf/mpd): Remove hardcoded uid in host path
-rw-r--r--home-manager/config/mpd/default.nix10
-rw-r--r--home-manager/config/zsh/default.nix3
2 files changed, 7 insertions, 6 deletions
diff --git a/home-manager/config/mpd/default.nix b/home-manager/config/mpd/default.nix
index 3c83a468..5d349fc0 100644
--- a/home-manager/config/mpd/default.nix
+++ b/home-manager/config/mpd/default.nix
@@ -2,16 +2,16 @@
   config,
   pkgs,
   lib,
-  nixosSystemConfig,
+  osConfig,
   ...
 }: let
   dataDir = "${config.xdg.dataHome}/mpd";
   playlistDirectory = "${dataDir}/playlists";
-  runtimeDir = "/run/user/1000/mpd"; # TODO don't hardcode uid
+  runtimeDir = "/run/user/${builtins.toString osConfig.users.users.soispha.uid}/mpd";
 in {
-  systemd.user.services.mpd.Service.ExecStartPre =
-    lib.mkForce ''
-      ${pkgs.coreutils}/bin/mkdir -p "${dataDir}" "${playlistDirectory}" "${runtimeDir}"'';
+  systemd.user.services.mpd.Service.ExecStartPre = lib.mkForce ''
+    ${pkgs.coreutils}/bin/mkdir -p "${dataDir}" "${playlistDirectory}" "${runtimeDir}"
+  '';
   services.mpd = {
     enable = true;
     inherit dataDir;
diff --git a/home-manager/config/zsh/default.nix b/home-manager/config/zsh/default.nix
index 54309cc8..c1c20899 100644
--- a/home-manager/config/zsh/default.nix
+++ b/home-manager/config/zsh/default.nix
@@ -4,6 +4,7 @@
   lib,
   shell_library,
   system,
+  osConfig,
   ...
 }: {
   # TODO ADD THIS ADDON
@@ -100,7 +101,7 @@
       BEMENU_BACKEND = "wayland";
       BEMENU_OPTS = "--fn 'Source Code Pro 10' -c -l 30 -B 1 -W 0.9 --hf #ffffff";
 
-      MPD_HOST = "/run/user/1000/mpd/socket";
+      MPD_HOST = "/run/user/${builtins.toString osConfig.users.users.soispha.uid}/mpd/socket";
 
       # Clean the home dir {{{
       CARGO_HOME = "${config.xdg.dataHome}/cargo";