aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/metamod-source.nix
diff options
context:
space:
mode:
authoryuuko <yuuko@partyvan.io>2024-08-29 21:51:04 -0700
committeryuuko <yuuko@partyvan.io>2024-08-29 21:51:04 -0700
commit56449e59d7aabd1c06fb67a51a1e129b55cb9270 (patch)
tree19f3faf805e9b6461a5940d1a050d13e5271ef55 /srcds-pkgs/metamod-source.nix
break out of system config
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;
+ };
+}