nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 121 lines 3.1 kB view raw
1{ 2 bash, 3 fetchFromGitHub, 4 gawk, 5 git, 6 lib, 7 procps, 8 stdenvNoCC, 9 unixtools, 10 unstableGitUpdater, 11 unzip, 12 usbutils, 13 util-linux, 14 wget, 15 writeShellApplication, 16 xdotool, 17 xwininfo, 18 xrandr, 19 xprop, 20 yad, 21}: 22 23stdenvNoCC.mkDerivation { 24 pname = "steamtinkerlaunch"; 25 version = "12.12-unstable-2025-07-14"; 26 27 src = fetchFromGitHub { 28 owner = "sonic2kk"; 29 repo = "steamtinkerlaunch"; 30 rev = "8550ab26a712b7f5f6d0947070181446b9de61fd"; 31 hash = "sha256-mCcxdm8odHvTt4aP58RHY6NkaUMmMbQesUtY6dvIvOc="; 32 }; 33 34 passthru.updateScript = unstableGitUpdater { 35 tagPrefix = "v"; 36 }; 37 38 outputs = [ 39 "out" 40 "steamcompattool" 41 ]; 42 43 installFlags = [ "PREFIX=\${out}" ]; 44 45 nativeBuildInputs = 46 let 47 # We need a `steam` command in order to install the compat tool 48 fakeSteam = writeShellApplication { 49 name = "steam"; 50 text = "exit 0"; 51 }; 52 in 53 [ 54 fakeSteam 55 ]; 56 57 postInstall = 58 let 59 # We (ab)use writeShellApplication to produce a header for a shell script 60 # here in order to add the runtimePath to the original script. We cannot 61 # wrap here as that always corrupts $0 in bash scripts which STL uses to 62 # install its compat tool. 63 header = writeShellApplication { 64 runtimeInputs = [ 65 bash 66 gawk 67 git 68 procps 69 unixtools.xxd 70 unzip 71 usbutils 72 util-linux 73 wget 74 xdotool 75 xprop 76 xrandr 77 xwininfo 78 yad 79 ]; 80 name = "stl-head"; 81 text = ""; 82 bashOptions = [ ]; 83 }; 84 fakeYad = writeShellApplication { 85 name = "yad"; 86 text = "echo ${yad.version} FAKE"; 87 }; 88 in 89 '' 90 cp $out/bin/steamtinkerlaunch $TMPDIR/steamtinkerlaunch 91 install ${lib.getExe header} -T $out/bin/steamtinkerlaunch 92 tail -n +2 $TMPDIR/steamtinkerlaunch >> $out/bin/steamtinkerlaunch 93 94 # Create a fake steam dir, it checks this and reads a few values 95 steamdir=$TMPDIR/.local/share/Steam/ 96 mkdir -p $steamdir/config/ 97 echo \"path\" \"$steamdir\" > $steamdir/config/config.vdf 98 mkdir $TMPDIR/.steam/ 99 ln -s $steamdir $TMPDIR/.steam/steam 100 101 cp -a $out/bin/steamtinkerlaunch $TMPDIR/steamtinkerlaunch 102 # yad cannot print its version without a graphical session https://github.com/v1cont/yad/issues/277 103 substituteInPlace $TMPDIR/steamtinkerlaunch --replace-fail ${yad} ${fakeYad} 104 HOME=$TMPDIR $TMPDIR/steamtinkerlaunch compat add 105 106 cp -a $steamdir/compatibilitytools.d/SteamTinkerLaunch $steamcompattool 107 # It creates this symlink but it points to $TMPDIR 108 ln -sfn $out/bin/steamtinkerlaunch $steamcompattool/ 109 ''; 110 111 meta = { 112 description = "Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs"; 113 mainProgram = "steamtinkerlaunch"; 114 homepage = "https://github.com/sonic2kk/steamtinkerlaunch"; 115 license = lib.licenses.gpl3; 116 maintainers = with lib.maintainers; [ 117 surfaceflinger 118 ]; 119 platforms = lib.platforms.linux; 120 }; 121}