summaryrefslogtreecommitdiffstats
path: root/pkgs/games/dwarf-fortress
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/dwarf-fortress')
-rw-r--r--pkgs/games/dwarf-fortress/default.nix2
-rw-r--r--pkgs/games/dwarf-fortress/dfhack/default.nix34
-rw-r--r--pkgs/games/dwarf-fortress/wrapper/default.nix26
-rwxr-xr-x[-rw-r--r--]pkgs/games/dwarf-fortress/wrapper/dfhack.in4
4 files changed, 31 insertions, 35 deletions
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index 382537282748..dd8e6b5503da 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -69,7 +69,7 @@ let
dfhack = callPackage ./dfhack {
inherit (perlPackages) XMLLibXML XMLLibXSLT;
- inherit dfVersion twbt;
+ inherit dfVersion;
stdenv = gccStdenv;
};
diff --git a/pkgs/games/dwarf-fortress/dfhack/default.nix b/pkgs/games/dwarf-fortress/dfhack/default.nix
index 49e8fabd45e4..57bbf0e11625 100644
--- a/pkgs/games/dwarf-fortress/dfhack/default.nix
+++ b/pkgs/games/dwarf-fortress/dfhack/default.nix
@@ -13,8 +13,6 @@
, allegro5
, libGLU
, libGL
-, enableTWBT ? true
-, twbt
, SDL
, dfVersion
}:
@@ -115,9 +113,9 @@ let
exit 1
fi
'';
-
- dfhack = stdenv.mkDerivation {
- pname = "dfhack-base";
+in
+ stdenv.mkDerivation {
+ pname = "dfhack";
inherit version;
# Beware of submodules
@@ -166,21 +164,13 @@ let
ln -s ${ruby}/lib/libruby-*.so $out/hack/libruby.so
'';
- };
-in
-
-buildEnv {
- name = "dfhack-${version}";
+ passthru = { inherit dfVersion; };
- passthru = { inherit version dfVersion; };
-
- paths = [ dfhack ] ++ lib.optionals enableTWBT [ twbt.lib ];
-
- meta = with lib; {
- description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
- homepage = "https://github.com/DFHack/dfhack/";
- license = licenses.zlib;
- platforms = [ "x86_64-linux" "i686-linux" ];
- maintainers = with maintainers; [ robbinch a1russell abbradar numinit ];
- };
-}
+ meta = with lib; {
+ description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
+ homepage = "https://github.com/DFHack/dfhack/";
+ license = licenses.zlib;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = with maintainers; [ robbinch a1russell abbradar numinit ];
+ };
+ }
diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix
index 0c1fbc6ca4de..e35575a8e73a 100644
--- a/pkgs/games/dwarf-fortress/wrapper/default.nix
+++ b/pkgs/games/dwarf-fortress/wrapper/default.nix
@@ -16,6 +16,7 @@
, twbt
, themes ? { }
, theme ? null
+, extraPackages ? [ ]
# General config options:
, enableIntro ? true
, enableTruetype ? true
@@ -27,7 +28,6 @@
let
dfhack_ = dfhack.override {
inherit enableStoneSense;
- inherit enableTWBT;
};
ptheme =
@@ -38,16 +38,16 @@ let
unBool = b: if b then "YES" else "NO";
# These are in inverse order for first packages to override the next ones.
- themePkg = lib.optional (theme != null) ptheme;
+ themePkgs = lib.optional (theme != null) ptheme;
pkgs = lib.optional enableDFHack dfhack_
++ lib.optional enableSoundSense soundSense
- ++ lib.optional enableTWBT twbt.art
+ ++ lib.optionals enableTWBT [ twbt.lib twbt.art ]
++ [ dwarf-fortress ];
- fixup = lib.singleton (runCommand "fixup" { } (''
+ config = runCommand "dwarf-fortress-config" { } (''
mkdir -p $out/data/init
'' + (if (theme != null) then ''
- cp ${lib.head themePkg}/data/init/init.txt $out/data/init/init.txt
+ cp ${ptheme}/data/init/init.txt $out/data/init/init.txt
'' else ''
cp ${dwarf-fortress}/data/init/init.txt $out/data/init/init.txt
'') + lib.optionalString enableDFHack ''
@@ -76,21 +76,24 @@ let
'' + ''
substituteInPlace $out/data/init/init.txt \
--replace '[INTRO:YES]' '[INTRO:${unBool enableIntro}]' \
- --replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
+ --replace '[TRUETYPE:24]' '[TRUETYPE:${unBool enableTruetype}]' \
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]' \
--replace '[SOUND:YES]' '[SOUND:${unBool enableSound}]'
- ''));
+ '');
env = buildEnv {
name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}";
- paths = fixup ++ themePkg ++ pkgs;
- pathsToLink = [ "/" "/hack" "/hack/scripts" ];
+ paths = extraPackages ++ [ config ] ++ themePkgs ++ pkgs;
ignoreCollisions = true;
};
in
+lib.throwIf (enableTWBT && !enableDFHack) "dwarf-fortress: TWBT requires DFHack to be enabled"
+lib.throwIf (enableStoneSense && !enableDFHack) "dwarf-fortress: StoneSense requires DFHack to be enabled"
+lib.throwIf (enableTextMode && enableTWBT) "dwarf-fortress: text mode and TWBT are mutually exclusive"
+
stdenv.mkDerivation {
pname = "dwarf-fortress";
version = dwarf-fortress.dfVersion;
@@ -114,7 +117,10 @@ stdenv.mkDerivation {
runDFHack = ./dfhack.in;
runSoundSense = ./soundSense.in;
- passthru = { inherit dwarf-fortress dwarf-therapist; };
+ passthru = {
+ inherit dwarf-fortress dwarf-therapist twbt;
+ dfhack = dfhack_;
+ };
buildCommand = ''
mkdir -p $out/bin
diff --git a/pkgs/games/dwarf-fortress/wrapper/dfhack.in b/pkgs/games/dwarf-fortress/wrapper/dfhack.in
index 026b33ab87bf..0f74674baf29 100644..100755
--- a/pkgs/games/dwarf-fortress/wrapper/dfhack.in
+++ b/pkgs/games/dwarf-fortress/wrapper/dfhack.in
@@ -2,8 +2,8 @@
source @dfInit@
-for i in dfhack.init-example dfhack-config/default hack/* stonesense/*; do
- update_path "$i"
+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"