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