aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs/sourcemod/with-plugins.nix
blob: 2a9ed9dd9a42639ead8af03e1d658eddc4d8ed0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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}
  '';
})