2024-08-18 19:41:20 +01:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
makeWrapper,
|
|
|
|
patchelf,
|
|
|
|
steamPackages,
|
|
|
|
replace-secret,
|
2022-04-23 04:08:45 +01:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
# Use the directory in which starbound is installed so steamcmd
|
|
|
|
# doesn't have to be reinstalled constantly (we're using DynamicUser
|
|
|
|
# with StateDirectory to persist this).
|
2024-08-18 19:41:20 +01:00
|
|
|
steamcmd = steamPackages.steamcmd.override { steamRoot = "/var/lib/starbound/.steamcmd"; };
|
|
|
|
wrapperPath = lib.makeBinPath [
|
|
|
|
patchelf
|
|
|
|
steamcmd
|
|
|
|
replace-secret
|
|
|
|
];
|
2022-04-23 04:08:45 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "starbound-update-script";
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
dontUnpack = true;
|
|
|
|
patchPhase = ''
|
|
|
|
interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
|
|
|
|
substitute ${./launch-starbound.sh} launch-starbound --subst-var interpreter
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp launch-starbound $out/bin/launch-starbound
|
|
|
|
chmod +x $out/bin/launch-starbound
|
|
|
|
'';
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/launch-starbound \
|
|
|
|
--prefix PATH : "${wrapperPath}"
|
|
|
|
'';
|
|
|
|
}
|