Fix the steam command thing maybe

This commit is contained in:
Lillian Violet 2024-03-21 14:33:31 +01:00
parent beefb2fb6c
commit 9b7505fdc5
2 changed files with 4 additions and 5 deletions

View file

@ -19,10 +19,8 @@
'';
systemd.services."external-drive-mount@" = {
path = with pkgs; [jq coreutils udisks bash util-linux toybox auto-mount];
path = with pkgs; [jq coreutils udisks bash util-linux toybox auto-mount steam];
enable = true;
scriptArgs = "%i";
serviceConfig = {
ExecStart = "${pkgs.auto-mount}/bin/auto-mount add %i";
ExecStop = "${pkgs.auto-mount}/bin/auto-mount remove %i";

View file

@ -1,6 +1,7 @@
{
lib,
stdenv,
steam-fsh,
jq,
coreutils,
udisks,
@ -14,7 +15,7 @@ writeShellApplication
name = "auto-mount";
runtimeInputs = [jq coreutils udisks util-linux toybox];
runtimeInputs = [jq coreutils udisks util-linux toybox steam];
text = ''
set -euo pipefail
@ -73,7 +74,7 @@ writeShellApplication
if pgrep -x "steam" > /dev/null; then
# TODO use -ifrunning and check return value - if there was a steam process and it returns -1, the message wasn't sent
# need to retry until either steam process is gone or -ifrunning returns 0, or timeout i guess
systemd-run -M 1000@ --user --collect --wait sh -c "./.steam/root/ubuntu12_32/steam steam://''${command}/''${encoded@Q}"
systemd-run -M 1000@ --user --collect --wait sh -c "${pkgs.steam}/bin/steam steam://''${command}/''${encoded@Q}"
echo "Sent URL to steam: steam://''${command}/''${arg} (steam://''${command}/''${encoded})"
else
echo "Could not send steam URL steam://''${command}/''${arg} (steam://''${command}/''${encoded}) -- steam not running"