2021-09-30 19:02:48 +00:00
|
|
|
{ lib
|
|
|
|
, alsa-lib
|
|
|
|
, fetchzip
|
|
|
|
, libXxf86vm
|
|
|
|
, makeWrapper
|
|
|
|
, openjdk
|
|
|
|
, stdenv
|
|
|
|
, xorg
|
2021-10-07 18:09:52 +00:00
|
|
|
, copyDesktopItems
|
|
|
|
, makeDesktopItem
|
2021-09-30 19:02:48 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "starsector";
|
2021-12-12 07:35:05 +00:00
|
|
|
version = "0.95.1a-RC5";
|
2021-09-30 19:02:48 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://s3.amazonaws.com/fractalsoftworks/starsector/starsector_linux-${version}.zip";
|
2021-12-12 07:35:05 +00:00
|
|
|
sha256 = "sha256-V8/WQPvPIrF3Tg7JVO+GfeYqWhkWWrnHSVcFXGQqDAA=";
|
2021-09-30 19:02:48 +00:00
|
|
|
};
|
|
|
|
|
2021-10-07 18:09:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
copyDesktopItems
|
|
|
|
makeWrapper
|
|
|
|
];
|
2021-09-30 19:02:48 +00:00
|
|
|
buildInputs = with xorg; [
|
|
|
|
alsa-lib
|
|
|
|
libXxf86vm
|
|
|
|
];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
2021-10-07 18:09:52 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "starsector";
|
|
|
|
exec = "starsector";
|
|
|
|
icon = "starsector";
|
|
|
|
comment = meta.description;
|
|
|
|
genericName = "starsector";
|
|
|
|
desktopName = "Starsector";
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Game" ];
|
2021-10-07 18:09:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-09-30 19:02:48 +00:00
|
|
|
# need to cd into $out in order for classpath to pick up correct jar files
|
|
|
|
installPhase = ''
|
2021-10-07 18:09:52 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2021-09-30 19:02:48 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
rm -r jre_linux # remove jre7
|
|
|
|
rm starfarer.api.zip
|
|
|
|
cp -r ./* $out
|
|
|
|
|
2021-10-07 18:09:52 +00:00
|
|
|
mkdir -p $out/share/icons/hicolor/64x64/apps
|
|
|
|
ln -s $out/graphics/ui/s_icon64.png $out/share/icons/hicolor/64x64/apps/starsector.png
|
|
|
|
|
2021-09-30 19:02:48 +00:00
|
|
|
wrapProgram $out/starsector.sh \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ openjdk ]} \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
|
2021-10-07 18:09:52 +00:00
|
|
|
--run 'mkdir -p ''${XDG_DATA_HOME:-~/.local/share}/starsector; cd '"$out"
|
2021-09-30 19:02:48 +00:00
|
|
|
ln -s $out/starsector.sh $out/bin/starsector
|
2021-10-07 18:09:52 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-09-30 19:02:48 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# it tries to run everything with relative paths, which makes it CWD dependent
|
|
|
|
# also point mod, screenshot, and save directory to $XDG_DATA_HOME
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace starsector.sh \
|
|
|
|
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
|
2021-10-07 18:09:52 +00:00
|
|
|
--replace "./native/linux" "$out/native/linux"
|
2021-09-30 19:02:48 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Open-world single-player space-combat, roleplaying, exploration, and economic game";
|
|
|
|
homepage = "https://fractalsoftworks.com";
|
|
|
|
license = licenses.unfree;
|
|
|
|
maintainers = with maintainers; [ bbigras ];
|
|
|
|
};
|
|
|
|
}
|