1 { lib, stdenv, fetchFromGitHub, fpc, zip, makeWrapper
2 , SDL2, freetype, physfs, openal, gamenetworkingsockets
3 , xorg, autoPatchelfHook, cmake
7 base = stdenv.mkDerivation rec {
8 pname = "opensoldat-base";
9 version = "unstable-2021-09-05";
11 src = fetchFromGitHub {
15 rev = "6c74d768d511663e026e015dde788006c74406b5";
16 sha256 = "175gmkdccy8rnkd95h2zqldqfydyji1hfby8b1qbnl8wz4dh08mz";
19 nativeBuildInputs = [ zip ];
26 install -Dm644 soldat.smod -t $out/share/soldat
27 install -Dm644 client/play-regular.ttf -t $out/share/soldat
31 description = "Opensoldat's base game content";
32 license = licenses.cc-by-40;
33 platforms = platforms.all;
34 inherit (src.meta) homepage;
40 stdenv.mkDerivation rec {
42 version = "unstable-2022-07-02";
44 src = fetchFromGitHub {
48 rev = "9574f5791b7993067f03d2df03d625908bc3762f";
49 sha256 = "0kyxzikd4ngx3nshjw0411x61zqq1b7l01lxw41rlcy4nad3r0vi";
52 nativeBuildInputs = [ fpc makeWrapper autoPatchelfHook cmake ];
55 "-DADD_ASSETS=OFF" # We provide base's smods via nix
56 "-DBUILD_GNS=OFF" # Don't build GameNetworkingSockets as an ExternalProject
59 buildInputs = [ SDL2 freetype physfs openal gamenetworkingsockets ];
60 # TODO(@sternenseemann): set proper rpath via cmake, so we don't need autoPatchelfHook
61 runtimeDependencies = [ xorg.libX11 ];
63 # make sure soldat{,server} find their game archive,
64 # let them write their state and configuration files
65 # to $XDG_CONFIG_HOME/soldat/soldat{,server} unless
66 # the user specifies otherwise.
67 # TODO(@sternenseemann): rename config dir to opensoldat
69 for p in $out/bin/soldatserver $out/bin/soldat; do
70 configDir="\''${XDG_CONFIG_HOME:-\$HOME/.config}/soldat/$(basename "$p")"
73 --run "mkdir -p \"$configDir\"" \
74 --add-flags "-fs_portable 0" \
75 --add-flags "-fs_userpath \"$configDir\"" \
76 --add-flags "-fs_basepath \"${base}/share/soldat\""
81 description = "Opensoldat is a unique 2D (side-view) multiplayer action game";
82 license = [ licenses.mit base.meta.license ];
83 inherit (src.meta) homepage;
84 maintainers = [ maintainers.sternenseemann ];
85 platforms = [ "x86_64-linux" "i686-linux" ];
86 # portability currently mainly limited by fpc
87 # in nixpkgs which doesn't work on darwin,
88 # aarch64 and arm support should be possible:
89 # https://github.com/opensoldat/opensoldat/issues/45