aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--srcds-pkgs/build-sm-plugin.nix7
-rw-r--r--srcds-pkgs/default.nix20
-rw-r--r--srcds-pkgs/mkdepot.nix7
-rw-r--r--srcds-pkgs/sourcemod/with-plugins.nix29
4 files changed, 50 insertions, 13 deletions
diff --git a/srcds-pkgs/build-sm-plugin.nix b/srcds-pkgs/build-sm-plugin.nix
index d55338d..d0f05de 100644
--- a/srcds-pkgs/build-sm-plugin.nix
+++ b/srcds-pkgs/build-sm-plugin.nix
@@ -50,7 +50,7 @@ stdenvNoCC.mkDerivation ({
cd /build/scripting
[ -d ./include ] && SPCOMPFLAGS="$SPCOMPFLAGS -i ./include"
for plug in *.sp; do
- spcomp -o "../plugins/disabled/''${plug%.sp}.smx" "$plug"
+ spcomp -o "../plugins/''${plug%.sp}.smx" "$plug"
done
runHook postBuild
'';
@@ -58,10 +58,13 @@ stdenvNoCC.mkDerivation ({
installPhase = ''
runHook preInstall
cd /build
+ for plug in plugins/*.smx; do
+ mv $plug plugins/disabled/
+ done
find . -type d -empty -delete
odir=$out/share/addons/sourcemod
mkdir -p $odir
- for d in scripting plugins translation gamedata; do
+ for d in scripting plugins translations gamedata; do
[ -d $d ] && cp -r $d $odir/$d
done
runHook postInstall
diff --git a/srcds-pkgs/default.nix b/srcds-pkgs/default.nix
index 1b8294c..dc402a9 100644
--- a/srcds-pkgs/default.nix
+++ b/srcds-pkgs/default.nix
@@ -1,33 +1,35 @@
-let f = self: with self; {
+let f = self: let
inherit (self) callPackage;
-
+in {
libfinite = callPackage ./bad/libfinite.nix {};
- mysql_5_5 = pkgs.pkgsi686Linux.callPackage ./bad/mysql_5_5.nix {};
+ mysql_5_5 = self.pkgs.pkgsi686Linux.callPackage ./bad/mysql_5_5.nix {};
ambuild = callPackage ./ambuild.nix {
- inherit (pkgs.python3Packages) buildPythonPackage;
+ inherit (self.pkgs.python3Packages) buildPythonPackage;
};
hl2sdk-2013 = callPackage ./hl2sdk-2013.nix {};
metamod-source = callPackage ./metamod-source.nix {
- hl2sdk = hl2sdk-2013;
+ hl2sdk = self.hl2sdk-2013;
};
sourcemod = callPackage ./sourcemod {
- hl2sdk = hl2sdk-2013;
+ hl2sdk = self.hl2sdk-2013;
};
buildSMPlugin = callPackage ./build-sm-plugin.nix {};
# TODO: see if it even makes sense to abstract this hard
# buildSMExtension = callPackage ./build-sm-extension.nix {};
+ sourcemodWithPlugins = callPackage ./sourcemod/with-plugins.nix {};
+
depotdownloader-json = callPackage ./depotdownloader-json {};
fetchDepotCache = callPackage ./fetchdepotcache.nix {
- depotdownloader = depotdownloader-json;
+ depotdownloader = self.depotdownloader-json;
};
fetchDepotFile = callPackage ./fetchdepotfile.nix {
- depotdownloader = depotdownloader-json;
+ depotdownloader = self.depotdownloader-json;
};
mkDepot = callPackage ./mkdepot.nix {};
@@ -52,4 +54,4 @@ let f = self: with self; {
, recurseIntoAttrs
, pkgs
}:
-recurseIntoAttrs (lib.makeScope newScope (self: f self // { inherit pkgs; }))
+lib.makeScope newScope (self: f (self // { inherit pkgs; }))
diff --git a/srcds-pkgs/mkdepot.nix b/srcds-pkgs/mkdepot.nix
index 8c1acaa..26d364b 100644
--- a/srcds-pkgs/mkdepot.nix
+++ b/srcds-pkgs/mkdepot.nix
@@ -1,5 +1,8 @@
{ lib, runCommand, fetchDepotFile }:
-name: caches: ps:
+{ name
+, caches
+, postScript ? ""
+}:
with lib;
let
emitStep = { FileName, Flags, Chunks, ... }@file:
@@ -15,5 +18,5 @@ let
in concatMapStrings mkStep (importJSON json).Files;
in runCommand name {} ''
${concatMapStringsSep "\n" emitManifest caches}
- ${ps}
+ ${postScript}
''
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}
+ '';
+})