Unverified Commit 38bf94b3 authored by Marcin Serwin's avatar Marcin Serwin Committed by GitHub
Browse files

xash3d-fwgs: init at 0-unstable-2026-02-25 (#384728)

parents 1bd07e79 49db235e
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  stdenv,
  wafHook,
  python3,
}:

stdenv.mkDerivation {
  pname = "hlsdk-portable";

  # Taken from build script: https://github.com/FWGS/hlsdk-portable/blob/afe7d33e15c75fa61fc5a8e287bc484146e7c377/wscript#L10
  version = "2.4";

  src = fetchFromGitHub {
    owner = "FWGS";
    repo = "hlsdk-portable";
    fetchSubmodules = true;
    rev = "afe7d33e15c75fa61fc5a8e287bc484146e7c377";
    hash = "sha256-lR5otfTur9yRcyAt/NkcCIYcqsMg2QQ+EdkA8o18vA0=";
  };

  nativeBuildInputs = [
    python3
    wafHook
  ];

  dontAddPrefix = true;

  wafConfigureFlags = [ "-T release" ] ++ lib.optionals stdenv.buildPlatform.is64bit [ "-8" ];

  wafInstallFlags = [ "--destdir=${placeholder "out"}" ];

  meta = {
    homepage = "https://github.com/FWGS/hlsdk-portable";
    description = "Portable crossplatform Half-Life SDK for GoldSource and Xash3D engines";
    license = lib.licenses.unfree;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ r4v3n6101 ];
  };
}
+102 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  stdenv,
  ensureNewerSourcesForZipFilesHook,
  python3,
  pkg-config,
  wafHook,
  SDL2,
  libx11,
  freetype,
  opusfile,
  libopus,
  libogg,
  libvorbis,
  bzip2,
  hlsdk-portable,
  makeWrapper,

  # Options
  buildSdk ? false,
  buildServer ? false,
}:
let
  exe = if buildServer then "xash" else "xash3d";
in
stdenv.mkDerivation {
  pname = "xash3d-fwgs";
  version = "0-unstable-2026-02-25";

  src = fetchFromGitHub {
    owner = "FWGS";
    repo = "xash3d-fwgs";
    rev = "2c004e6cb78f0b435f2923a5105c9df43130e337";
    hash = "sha256-Bh0JaeDO/RrMSQKvqJGbmrQoG1aR7Q+5YnBEedARliU=";
    postCheckout = ''
      cd $out/3rdparty
      git submodule update --init --recursive \
        MultiEmulator extras/xash-extras gl-wes-v2 gl4es/gl4es \
        libbacktrace/libbacktrace library_suffix maintui mainui nanogl \
        vgui_support
    '';
  };

  nativeBuildInputs = [
    ensureNewerSourcesForZipFilesHook
    python3
    pkg-config
    wafHook
    makeWrapper
  ];

  buildInputs =
    lib.optionals (!buildServer) [
      freetype
      opusfile
      libopus
      libogg
      libvorbis
      bzip2
      SDL2
    ]
    ++ lib.optionals (!buildServer && stdenv.isLinux) [
      libx11
    ];

  dontAddPrefix = true;

  wafConfigureFlags = [
    "-T release"
  ]
  ++ lib.optionals buildServer [
    "-d"
  ]
  ++ lib.optionals (!buildServer) [
    "--sdl-use-pkgconfig"
  ]
  ++ lib.optionals stdenv.buildPlatform.is64bit [ "-8" ];

  wafInstallFlags = [ "--destdir=${placeholder "out"}/lib" ];

  postInstall = ''
    mkdir -p $out/bin
    mv $out/lib/${exe} $out/bin/${exe}-unwrapped
    makeWrapper $out/bin/${exe}-unwrapped $out/bin/${exe} \
      --set XASH3D_RODIR $out/lib/valve \
      --run "export XASH3D_BASEDIR=\$HOME/.xash3d/" \
      --prefix ${
        if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"
      } : "$out/lib"
  ''
  + lib.optionalString buildSdk "cp -TR ${hlsdk-portable}/valve $out/lib/valve";

  meta = {
    homepage = "https://github.com/FWGS/xash3d-fwgs";
    description = "Xash3D FWGS engine";
    license = lib.licenses.gpl3Plus;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ r4v3n6101 ];
    mainProgram = exe;
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -11386,6 +11386,8 @@ with pkgs;
    xonotic
    ;

  xash-dedicated = callPackage ../by-name/xa/xash3d-fwgs/package.nix { buildServer = true; };

  xonotic-glx =
    (callPackage ../games/xonotic {
      withSDL = false;