aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/metamod-source.nix
diff options
context:
space:
mode:
Diffstat (limited to 'srcds-pkgs/metamod-source.nix')
-rw-r--r--srcds-pkgs/metamod-source.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/srcds-pkgs/metamod-source.nix b/srcds-pkgs/metamod-source.nix
new file mode 100644
index 0000000..2f9c92e
--- /dev/null
+++ b/srcds-pkgs/metamod-source.nix
@@ -0,0 +1,66 @@
+{ lib, multiStdenv
+, fetchFromGitHub, ed
+, hl2sdk, ambuild, libfinite
+}: let
+ owner = "alliedmodders";
+ buildno = "1155";
+in multiStdenv.mkDerivation rec {
+ pname = "metamod-source";
+ version = "1.11_${buildno}";
+
+ src = fetchFromGitHub rec {
+ inherit owner;
+ repo = pname;
+ rev = "2009298c32735b6de1712ff88e2309c";
+ fetchSubmodules = true;
+ hash = "sha256-cPrllC3IljtV9SWn2NZbV8yHvehqLNGkZQ0RK07yCz4=";
+ };
+
+ nativeBuildInputs = [ ambuild ed ];
+
+ hardeningDisable = [ "all" ];
+
+ CXXFLAGS="-Wno-error=class-memaccess -Wno-error=format-truncation";
+
+ postPatch = ''
+ mkdir .git
+ echo "ref: refs/heads/main" > .git/HEAD
+ ed support/buildbot/generate_headers.py <<EOF
+ /^def get_git_version/;/return/a
+ def get_git_version():
+ return '${buildno}', '${builtins.substring 0 7 src.rev}', '${src.rev}'
+ .
+ w
+ EOF
+ ed AMBuildScript <<EOF
+ /tier1]/s|]|, '${libfinite}' ]|
+ w
+ EOF
+ '';
+
+ configurePhase = ''
+ ln -s ${hl2sdk} ${hl2sdk.name}
+
+ mkdir -p build
+ pushd build
+ python ../configure.py --sdks present
+ '';
+
+ buildPhase = ''
+ ambuild
+ popd
+ '';
+
+ installPhase = ''
+ mkdir $out
+ mv build/package $out/share
+ cp -r $src $out/include
+ '';
+
+ meta = with lib; {
+ description = "C++ plugin environment and detour library for the Source Engine";
+ homepage = "https://github.com/${owner}/${pname}";
+ platforms = platforms.unix;
+ license = licenses.zlib;
+ };
+}