14 stdenv.mkDerivation rec {
16 version = "0.96a-RC10";
19 url = "https://f005.backblazeb2.com/file/fractalsoftworks/release/starsector_linux-${version}.zip";
20 sha256 = "sha256-RBSnms+QlKgTOhm3t2hDfv7OcMrQCk1rfkz9GaM74WM=";
23 nativeBuildInputs = [ copyDesktopItems makeWrapper ];
24 buildInputs = [ xorg.libXxf86vm openal ];
33 comment = meta.description;
34 genericName = "starsector";
35 desktopName = "Starsector";
36 categories = [ "Game" ];
40 # need to cd into $out in order for classpath to pick up correct jar files
44 mkdir -p $out/bin $out/share/starsector
45 rm -r jre_linux # remove bundled jre7
47 cp -r ./* $out/share/starsector
49 mkdir -p $out/share/icons/hicolor/64x64/apps
50 ln -s $out/graphics/ui/s_icon64.png $out/share/icons/hicolor/64x64/apps/starsector.png
52 wrapProgram $out/share/starsector/starsector.sh \
53 --prefix PATH : ${lib.makeBinPath [ openjdk ]} \
54 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} \
55 --run 'mkdir -p ''${XDG_DATA_HOME:-~/.local/share}/starsector' \
56 --chdir "$out/share/starsector"
57 ln -s $out/share/starsector/starsector.sh $out/bin/starsector
62 # it tries to run everything with relative paths, which makes it CWD dependent
63 # also point mod, screenshot, and save directory to $XDG_DATA_HOME
64 # additionally, add some GC options to improve performance of the game
66 substituteInPlace starsector.sh \
67 --replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
68 --replace "./native/linux" "$out/share/starsector/native/linux" \
69 --replace "=." "=\''${XDG_DATA_HOME:-\$HOME/.local/share}/starsector" \
70 --replace "-XX:+CompilerThreadHintNoPreempt" "-XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSConcurrentMTEnabled -XX:+DisableExplicitGC"
74 description = "Open-world single-player space-combat, roleplaying, exploration, and economic game";
75 homepage = "https://fractalsoftworks.com";
76 sourceProvenance = with sourceTypes; [ binaryBytecode ];
77 license = licenses.unfree;
78 maintainers = with maintainers; [ bbigras ];
81 passthru.updateScript = writeScript "starsector-update-script" ''
82 #!/usr/bin/env nix-shell
83 #!nix-shell -i bash -p curl gnugrep common-updater-scripts
85 version=$(curl -s https://fractalsoftworks.com/preorder/ | grep -oP "https://f005.backblazeb2.com/file/fractalsoftworks/release/starsector_linux-\K.*?(?=\.zip)" | head -1)
86 update-source-version ${pname} "$version" --file=./pkgs/games/starsector/default.nix