aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/sourcemod/with-plugins.nix
diff options
context:
space:
mode:
Diffstat (limited to 'srcds-pkgs/sourcemod/with-plugins.nix')
-rw-r--r--srcds-pkgs/sourcemod/with-plugins.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/srcds-pkgs/sourcemod/with-plugins.nix b/srcds-pkgs/sourcemod/with-plugins.nix
new file mode 100644
index 0000000..2a9ed9d
--- /dev/null
+++ b/srcds-pkgs/sourcemod/with-plugins.nix
@@ -0,0 +1,29 @@
+{ sourcemod, metamod-source
+, symlinkJoin
+}:
+{ configs ? []
+, postBuild ? ""
+, plugins ? []
+, enabledPlugins ? []
+, name ? "sourcemodWithPlugins"
+}@args:
+symlinkJoin (args // {
+ paths = configs ++ [ metamod-source sourcemod ] ++ plugins;
+ inherit name;
+ postBuild = ''
+ if [ -n "''${enabledPlugins:-}" ]; then
+ pushd $out/share/addons/sourcemod/plugins
+ mkdir -p disabled
+ for plug in $enabledPlugins; do
+ fp=disabled/"$plug.smx"
+ [ -e "$fp" ] || {
+ echo "No such plugin $fp" >&2
+ exit 1
+ }
+ ln -s "$fp" ./
+ done
+ popd
+ fi
+ ${postBuild}
+ '';
+})