From cfd7037d2a0145ac5e2c33ffa57df1d62716acfb Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Thu, 30 Sep 2021 15:02:48 -0400 Subject: [PATCH] starsector: init at 0.95a-RC15 Co-authored-by: Jonathan Ringer Co-authored-by: mitchmindtree --- pkgs/games/starsector/default.nix | 57 +++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 2 files changed, 61 insertions(+) create mode 100644 pkgs/games/starsector/default.nix diff --git a/pkgs/games/starsector/default.nix b/pkgs/games/starsector/default.nix new file mode 100644 index 000000000000..a4819a4fdadf --- /dev/null +++ b/pkgs/games/starsector/default.nix @@ -0,0 +1,57 @@ +{ lib +, alsa-lib +, fetchzip +, libXxf86vm +, makeWrapper +, openjdk +, stdenv +, xorg +}: + +stdenv.mkDerivation rec { + pname = "starsector"; + version = "0.95a-RC15"; + + src = fetchzip { + url = "https://s3.amazonaws.com/fractalsoftworks/starsector/starsector_linux-${version}.zip"; + sha256 = "sha256-/5ij/079aOad7otXSFFcmVmiYQnMX/0RXGOr1j0rkGY="; + }; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = with xorg; [ + alsa-lib + libXxf86vm + ]; + + dontBuild = true; + + # need to cd into $out in order for classpath to pick up correct jar files + installPhase = '' + mkdir -p $out/bin + rm -r jre_linux # remove jre7 + rm starfarer.api.zip + cp -r ./* $out + + wrapProgram $out/starsector.sh \ + --prefix PATH : ${lib.makeBinPath [ openjdk ]} \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \ + --run "mkdir -p \$XDG_DATA_HOME/starsector; cd $out" + ln -s $out/starsector.sh $out/bin/starsector + ''; + + # 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" \ + --replace "./native/linux" "$out/native/linux" \ + --replace "./" "\$XDG_DATA_HOME/starsector/" + ''; + + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fde403f4af89..9a78302fe4bc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9288,6 +9288,10 @@ with pkgs; sqls = callPackage ../applications/misc/sqls { }; + starsector = callPackage ../games/starsector { + openjdk = openjdk8; + }; + stdman = callPackage ../data/documentation/stdman { }; steck = callPackage ../servers/pinnwand/steck.nix { };