Skip to content

Instantly share code, notes, and snippets.

@chayleaf
Last active March 2, 2023 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chayleaf/17e6b052ae6e090e866384b8750cef0e to your computer and use it in GitHub Desktop.
Save chayleaf/17e6b052ae6e090e866384b8750cef0e to your computer and use it in GitHub Desktop.
xash3d-fwgs vulkan fork on NixOS
diff --git a/scripts/waifulib/sebastian.py b/scripts/waifulib/sebastian.py
index a3b946a2..1bf6b922 100644
--- a/scripts/waifulib/sebastian.py
+++ b/scripts/waifulib/sebastian.py
@@ -3,9 +3,8 @@ import json, os
def configure(conf):
conf.find_program('sebastian', var='SEBASTIAN', exts='.py', path_list=[conf.path.abspath()])
- if conf.env.DEST_OS == 'win32':
- conf.find_program('python')
- conf.env.SEBASTIAN = conf.env.PYTHON + conf.env.SEBASTIAN
+ conf.find_program('python')
+ conf.env.SEBASTIAN = conf.env.PYTHON + conf.env.SEBASTIAN
class sebastian(Task.Task):
color = 'CYAN'
{ lib
, pkgs
, stdenv
, fetchFromGitHub
, vulkan-loader
, dedicated ? false
, gamedir ? "valve"
, enableBsp2 ? false # bsp2 support (for quake)
, enableGles1 ? false # gles1 renderer (nanogl)
, enableGles2 ? false # gles2 renderer (glwes)
, enableGl4es ? false # gles2 renderer (gl4es)
, enableGl ? true # opengl renderer
, enableVulkan ? true # vulkan renderer
, enableSoft ? true # soft renderer
, enableUtils ? false # mdldec
}:
stdenv.mkDerivation {
pname = "xash3d-fwgs";
version = "2023-03-01";
nativeBuildInputs = with pkgs; [python3 pkg-config makeWrapper shaderc];
buildInputs = with pkgs; [SDL2 libopus freetype fontconfig] ++ (lib.optionals enableVulkan [vulkan-headers]);
src = fetchFromGitHub {
owner = "w23";
repo = "xash3d-fwgs";
rev = "8a457a17c2ec7138eb8453c6fe38784e39d7c8e8";
sha256 = "sha256-orjU144tcWEi6he2OUJnStLPPsoeu31dZN4H58Il2Ag=";
fetchSubmodules = true;
};
patches = [ ./change-zip-date.patch ./nix-patch.patch ];
configurePhase = let
optionals = lib.optionals;
optional = (cond: val: optionals cond [val]);
flags = ["-8" "-P" "--prefix=/"]
++ (optional dedicated "-d")
++ (optionals (gamedir != "valve") ["--gamedir" gamedir])
++ (optional enableBsp2 "--enable-bsp2")
++ (optional enableGles1 "--enable-gles1")
++ (optional enableGles2 "--enable-gles2")
++ (optional enableGl4es "--enable-gl4es")
++ (optional (!enableGl) "--disable-gl")
++ (optional (!enableSoft) "--disable-soft")
++ (optional (!enableVulkan) "--disable-vulkan")
++ (optional enableUtils "--enable-utils")
;
in ''
python3 ./waf configure -T release ${lib.strings.escapeShellArgs flags}
'';
buildPhase = ''
python3 ./waf build
'';
installPhase = ''
python3 ./waf install "--destdir=$out"
mkdir $out/bin
makeWrapper $out/lib/xash3d/xash3d $out/bin/xash3d \
--set XASH3D_EXTRAS_PAK1 $out/share/xash3d/valve/extras.pk3 \
--prefix LD_LIBRARY_PATH : "${vulkan-loader}/lib"
'';
meta = with lib; {
description = "Xash3D FWGS engine";
homepage = "https://github.com/FWGS/xash3d-fwgs";
license = with licenses; [ unfree gpl3 ];
# maintainers = with maintainers; [ chayleaf ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment