From 9dbe998f0d956a01dd9e04169dd3eadfdffdfa19 Mon Sep 17 00:00:00 2001 From: cspark Date: Thu, 21 Mar 2024 16:01:57 +0000 Subject: [PATCH] MPD services configuration --- global-home.nix | 40 +++++++++++++++++++++++++++++++++++++++- global.nix | 13 ++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/global-home.nix b/global-home.nix index 90befa9e..35335447 100644 --- a/global-home.nix +++ b/global-home.nix @@ -131,7 +131,45 @@ in ExecStart = "${script}"; }; Install = { - WantedBy = [ "multi-user.target" ]; + WantedBy = [ "default.target" ]; + }; + }; + + # This service appears to have issues when system sleeps - restart service + systemd.user.services.mpd-discord-rpc-refresh = let + script = pkgs.writeShellScript "mpd-discord-rpc-refresh-script" + '' + systemctl --user restart mpd-discord-rpc.service + ''; + in + { + Unit = { + Description = "Refresh mpd--discord-rpc service on sleep/hibernate/login to resolve issues"; + Before = [ "systemd-suspend.service" "systemd-hibernate.service" "systemd-hybrid-sleep.service" ]; + }; + Service = { + ExecStart = "${script}"; + }; + Install = { + WantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "xdg-desktop-autostart.target" ]; + }; + }; + + systemd.user.services.mpd-discord-rpc-start = let + script = pkgs.writeShellScript "mpd-discord-rpc-start-script" + '' + systemctl --user start mpd.service + ''; + in + { + Unit = { + Description = "Start MPD on boot"; + }; + Service = { + ExecStart = "${script}"; + }; + Install = { + WantedBy = [ "default.target" ]; }; }; diff --git a/global.nix b/global.nix index c157fc3e..af739aa6 100644 --- a/global.nix +++ b/global.nix @@ -86,13 +86,24 @@ LXVST_PATH = makePluginPath "lxvst"; VST_PATH = makePluginPath "vst"; VST3_PATH = makePluginPath "vst3"; + + # Dotnet libicu not found fix + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = "1"; }; + # NixOS Dynamic Libraries Fix + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs + # here, NOT in environment.systemPackages + icu + ]; + # Emacs Config Init Service - For root user also systemd.services.emacs-config-initialiser = { description = "Initialises default emacs configuration if not available"; wantedBy = [ "multi-user.target" ]; - path = [ pkgs.coreutils pkgs.git ]; + path = with pkgs; [ coreutils git ]; enable = true; serviceConfig = { User = "root";