aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/extensions/SM-Memory.nix
diff options
context:
space:
mode:
Diffstat (limited to 'srcds-pkgs/extensions/SM-Memory.nix')
-rw-r--r--srcds-pkgs/extensions/SM-Memory.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/srcds-pkgs/extensions/SM-Memory.nix b/srcds-pkgs/extensions/SM-Memory.nix
new file mode 100644
index 0000000..5d1761a
--- /dev/null
+++ b/srcds-pkgs/extensions/SM-Memory.nix
@@ -0,0 +1,51 @@
+{ lib, multiStdenv, fetchFromGitHub
+, metamod-source, sourcemod, ambuild
+, ed
+}:
+multiStdenv.mkDerivation rec {
+ pname = "SM-Memory";
+ version = "1.5.1";
+
+ src = fetchFromGitHub {
+ owner = "Scags";
+ repo = pname;
+ rev = "V${version}";
+ sha256 = "031nbx18hhqgnryzy00rv5bc8v1k7fbkb3677ndm7nkif13p12aa";
+ };
+
+ nativeBuildInputs = [ ambuild sourcemod ed ];
+
+ patchPhase = ''
+ pushd pawn/sourcemod/scripting
+ substituteInPlace memtest_{func,vec}.sp --replace smmem_ smmem/
+ ed memtest.sp <<EOF
+ /#include/a
+ #include <smmem/dynlib.inc>
+ .
+ w
+ EOF
+ popd
+ '';
+
+ configurePhase = ''
+ cd build
+ python ../configure.py \
+ --sm-path ${sourcemod.src} \
+ --mms-path ${metamod-source.src}
+ '';
+
+ buildPhase = ''
+ ambuild
+ pushd package/addons/sourcemod/scripting
+ mkdir -p ../plugins/disabled
+ for i in *.sp; do
+ spcomp -i include $i -o ../plugins/disabled/''${i%.sp}.smx
+ done
+ popd
+ '';
+
+ installPhase = ''
+ mkdir $out
+ mv package $out/share
+ '';
+}