diff --git a/modules/devices/steamdeck/default.nix b/modules/devices/steamdeck/default.nix index a70b55ca..e69ce452 100644 --- a/modules/devices/steamdeck/default.nix +++ b/modules/devices/steamdeck/default.nix @@ -23,6 +23,7 @@ in ./perf-control.nix ./sdgyrodsu.nix ./sound.nix + ./workarounds.nix ]; options = { diff --git a/modules/devices/steamdeck/workarounds.nix b/modules/devices/steamdeck/workarounds.nix new file mode 100644 index 00000000..a50e2055 --- /dev/null +++ b/modules/devices/steamdeck/workarounds.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) + mkIf + mkMerge + mkOption + types + ; + + cfg = config.jovian.devices.steamdeck; +in +{ + options = { + jovian.devices.steamdeck = { + enableDeviceDataWorkarounds = mkOption { + type = types.bool; + default = cfg.enable; + defaultText = lib.literalExpression "config.jovian.devices.steamdeck.enable"; + description = '' + Whether to add some workarounds for (Steam Deck) device-specific data. + ''; + # Don't expose to users. + internal = true; + readOnly = true; + }; + }; + }; + config = mkIf (cfg.enableDeviceDataWorkarounds) (mkMerge [ + { + systemd.services."jovian-dmidecode-workaround" = { + enable = true; + unitConfig.ConditionPathIsDirectory = "/run"; + before = [ "multi-user.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + #!${pkgs.runtimeShell} + mkdir -p /run/jovian + ${pkgs.dmidecode}/bin/dmidecode -t 11 > /run/jovian/dmidecode-11.txt + ''; + }; + } + ]); +} diff --git a/pkgs/jovian-stubs/default.nix b/pkgs/jovian-stubs/default.nix index bd210376..7e34398c 100644 --- a/pkgs/jovian-stubs/default.nix +++ b/pkgs/jovian-stubs/default.nix @@ -9,6 +9,7 @@ stdenv.mkDerivation { install -D -m 755 ${./steamos-select-branch} $out/bin/steamos-select-branch install -D -m 755 ${./steamos-update} $out/bin/steamos-update + install -D -m 755 ${./dmidecode} $out/bin/dmidecode install -D -m 755 ${./pkexec} $out/bin/pkexec install -D -m 755 ${./sudo} $out/bin/sudo ''; diff --git a/pkgs/jovian-stubs/dmidecode b/pkgs/jovian-stubs/dmidecode new file mode 100644 index 00000000..46024322 --- /dev/null +++ b/pkgs/jovian-stubs/dmidecode @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +>&2 echo "[JOVIAN] $0: stub called with: $*" + +if [ "$*" == "-t 11" ]; then + >&2 echo "[JOVIAN] $0: replying with cached data" + cat /run/jovian/dmidecode-11.txt + exit 0 +fi + +>&2 echo "[JOVIAN] $0: don't know how to handle $*" +exit 1 diff --git a/pkgs/jupiter-hw-support/polkit-helpers.nix b/pkgs/jupiter-hw-support/polkit-helpers.nix index 584e7c4d..b17e6902 100644 --- a/pkgs/jupiter-hw-support/polkit-helpers.nix +++ b/pkgs/jupiter-hw-support/polkit-helpers.nix @@ -4,7 +4,6 @@ resholve, bash, coreutils, - dmidecode, gawk, gnugrep, jovian-stubs, @@ -23,7 +22,6 @@ let interpreter = "${bash}/bin/bash"; inputs = [ coreutils - dmidecode gawk gnugrep "${jupiter-dock-updater-bin}/lib/jupiter-dock-updater" @@ -40,6 +38,7 @@ let "cannot:${jovian-stubs}/bin/steamos-factory-reset-config" "cannot:${jovian-stubs}/bin/steamos-select-branch" "cannot:${jovian-stubs}/bin/steamos-update" + "cannot:${jovian-stubs}/bin/dmidecode" "cannot:${jupiter-dock-updater-bin}/lib/jupiter-dock-updater/jupiter-dock-updater.sh" "cannot:${jupiter-hw-support}/bin/jupiter-check-support" "cannot:${jupiter-hw-support}/lib/hwsupport/format-device.sh" diff --git a/pkgs/steam-jupiter/fhsenv.nix b/pkgs/steam-jupiter/fhsenv.nix index 4ec6f29d..8d6814f0 100644 --- a/pkgs/steam-jupiter/fhsenv.nix +++ b/pkgs/steam-jupiter/fhsenv.nix @@ -2,7 +2,6 @@ # dependencies of the Steam Deck UI { writeShellScriptBin -, dmidecode , jovian-stubs , steam # , steamos-polkit-helpers @@ -14,7 +13,6 @@ let "lib" "runCommand" "writeShellScriptBin" - "dmidecode" "jovian-stubs" "steam" "steamos-polkit-helpers" @@ -45,7 +43,6 @@ let wrappedSteam = steam.override (extraArgs // { extraPkgs = pkgs: (if args ? extraPkgs then args.extraPkgs pkgs else []) ++ [ - dmidecode jovian-stubs sessionSwitcher