nixpkgs/pkgs/games/dwarf-fortress/wrapper/dfhack.in
Naïm Favier 839fdd101c
dwarf-fortress.dfhack: make overridable
Currently, it is quite hard to override anything about dfhack (for
example, to add plugins at build time), because

1. it is not exposed anywhere, so you have to do something like
   `dwarf-fortress.override (oldArgs: { dfhack = oldArgs.dfhack.override...; })`
2. the final `dfhack` derivation is a `buildEnv`, so `overrideAttrs`
   doesn't work as expected.

This fixes 1 by adding `dfhack` to the wrapper's `passthru`, and 2 by
moving `twbt.lib` (which is the only reason for the dfhack `buildEnv`)
into the wrapper.

Also adds an `extraPackages` argument to the wrapper, and copies `*.init`
files from the env to the DF directory so that we can easily add a
`dfhack.init`.

With these changes, I was able to build dfhack with the dfplex plugin.
2022-11-17 00:06:31 +01:00

11 lines
380 B
Text
Executable file

#!@stdenv_shell@ -e
source @dfInit@
for i in *.init *.init-example dfhack-config/default dfhack-config/init hack/* stonesense/*; do
if [ -e "$i" ]; then update_path "$i"; fi
done
cd "$DF_DIR"
LD_LIBRARY_PATH="$env_dir/hack/libs:$env_dir/hack${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \
LD_PRELOAD="$env_dir/hack/libdfhack.so:$LD_PRELOAD" exec $env_dir/libs/Dwarf_Fortress "$@"