armagetronad."0.4": fix installCheckPhase requiring an X server

+12 -3
+12 -3
pkgs/games/armagetronad/default.nix
··· 21 21 , libpng 22 22 , libxml2 23 23 , protobuf 24 + , xvfb-run 24 25 , dedicatedServer ? false 25 26 }: 26 27 ··· 61 62 extraBuildInputs = [ protobuf boost ] 62 63 ++ lib.optionals (!dedicatedServer) [ glew ftgl freetype SDL2 SDL2_image SDL2_mixer ]; 63 64 extraNativeBuildInputs = [ bison ]; 65 + extraNativeInstallCheckInputs = lib.optionals (!dedicatedServer) [ xvfb-run ]; 64 66 }; 65 67 66 68 # https://gitlab.com/armagetronad/armagetronad/-/commits/hack-0.2.8-sty+ct+ap/?ref_type=heads ··· 134 136 nativeBuildInputs = [ autoconf automake gnum4 pkg-config which python3 ] 135 137 ++ (resolvedParams.extraNativeBuildInputs or []); 136 138 139 + nativeInstallCheckInputs = resolvedParams.extraNativeInstallCheckInputs or []; 140 + 137 141 postInstall = lib.optionalString (!dedicatedServer) '' 138 142 mkdir -p $out/share/{applications,icons/hicolor} 139 143 ln -s $out/share/games/armagetronad/desktop/armagetronad*.desktop $out/share/applications/ ··· 145 149 installCheckPhase = '' 146 150 export XDG_RUNTIME_DIR=/tmp 147 151 bin="$out/bin/${mainProgram}" 148 - version="$("$bin" --version || true)" 149 - prefix="$("$bin" --prefix || true)" 150 - rubber="$("$bin" --doc | grep -m1 CYCLE_RUBBER)" 152 + if command -v xvfb-run &>/dev/null; then 153 + run="xvfb-run $bin" 154 + else 155 + run="$bin" 156 + fi 157 + version="$($run --version || true)" 158 + prefix="$($run --prefix || true)" 159 + rubber="$($run --doc | grep -m1 CYCLE_RUBBER)" 151 160 152 161 echo "Version: $version" >&2 153 162 echo "Prefix: $prefix" >&2