about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSvein Ove Aas <sveina@gmail.com>2018-07-05 20:09:03 +0100
committerSvein Ove Aas <sveina@gmail.com>2018-07-05 20:48:52 +0100
commitb0c7245ee5ea9a93b9bdd2896c90fe822edb0596 (patch)
tree7155dddb5b67d544d17737435e857263a264cc92 /pkgs
parent5012ce727ab54d7fe02ae730011d3160ab3743a0 (diff)
downloadnixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar.gz
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar.bz2
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar.lz
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar.xz
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.tar.zst
nixlib-b0c7245ee5ea9a93b9bdd2896c90fe822edb0596.zip
dwarf-fortress: Add "lazy pack", config flags and some comments.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/dwarf-fortress/default.nix27
-rw-r--r--pkgs/games/dwarf-fortress/lazy-pack.nix36
-rw-r--r--pkgs/games/dwarf-fortress/twbt/default.nix6
-rw-r--r--pkgs/games/dwarf-fortress/wrapper/default.nix19
4 files changed, 82 insertions, 6 deletions
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index f0dd7f08020f..bfb22aa3a3d1 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -1,9 +1,32 @@
-{ pkgs, stdenv, stdenvNoCC, gccStdenv }:
+{ pkgs, stdenv, stdenvNoCC, buildEnv, gccStdenv }:
+
+# To whomever it may concern:
+#
+# This directory menaces with spikes of Nix code. It is terrifying.
+#
+# If this is your first time here, you should probably install the dwarf-fortress-full package,
+# for instance with `environment.systempackages = [ pkgs.dwarf-fortress.dwarf-fortress-full ];`.
+#
+# You can adjust its settings by using override, or compile your own package by
+# using the other packages here. Take a look at lazy-pack.nix to get an idea of
+# how.
+#
+# You will find the configuration files in ~/.local/share/df_linux/data/init. If
+# you un-symlink them and edit, then the scripts will avoid overwriting your
+# changes on later launches, but consider extending the wrapper with your
+# desired options instead.
+#
+# Although both dfhack and dwarf therapist are included in the lazy pack, you
+# can only use one at a time. DFHack does have therapist-like features, so this
+# may or may not be a problem.
 
 let
   callPackage = pkgs.newScope self;
 
   self = rec {
+
+    dwarf-fortress-full = callPackage ./lazy-pack.nix { };
+
     dwarf-fortress-original = callPackage ./game.nix { };
 
     dfhack = callPackage ./dfhack {
@@ -13,7 +36,7 @@ let
 
     soundSense = callPackage ./soundsense.nix { };
 
-    # unfuck is linux-only right now, we will just use it there
+    # unfuck is linux-only right now, we will only use it there.
     dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { }
                                  else null;
 
diff --git a/pkgs/games/dwarf-fortress/lazy-pack.nix b/pkgs/games/dwarf-fortress/lazy-pack.nix
new file mode 100644
index 000000000000..3aa9e573f61d
--- /dev/null
+++ b/pkgs/games/dwarf-fortress/lazy-pack.nix
@@ -0,0 +1,36 @@
+{ stdenvNoCC, lib, buildEnv, callPackage
+, dwarf-fortress, themes
+  # This package should, at any given time, provide an opinionated "optimal"
+  # DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and
+  # should contain every utility available.
+, enableDFHack ? stdenvNoCC.isLinux
+, enableTWBT ? enableDFHack
+, enableSoundSense ? true
+, enableStoneSense ? false  # StoneSense is currently broken.
+, enableDwarfTherapist ? true, dwarf-therapist
+, enableLegendsBrowser ? true, legends-browser
+, theme ? themes.phoebus
+# General config options:
+, enableIntro ? true
+, enableTruetype ? true
+, enableFPS ? false
+}:
+
+buildEnv {
+  name = "dwarf-fortress-full";
+  paths = [
+    (dwarf-fortress.override {
+      inherit enableDFHack enableTWBT enableSoundSense enableStoneSense theme
+              enableIntro enableTruetype enableFPS;
+    })]
+    ++ lib.optional enableDwarfTherapist dwarf-therapist
+    ++ lib.optional enableLegendsBrowser legends-browser;
+
+  meta = with stdenvNoCC.lib; {
+    description = "An opinionated wrapper for Dwarf Fortress";
+    maintainers = with maintainers; [ Baughn ];
+    license = licenses.mit;
+    platforms = platforms.all;
+    homepage = https://github.com/NixOS/nixpkgs/;
+  };
+}
diff --git a/pkgs/games/dwarf-fortress/twbt/default.nix b/pkgs/games/dwarf-fortress/twbt/default.nix
index c262ae6572fa..b56170e5229a 100644
--- a/pkgs/games/dwarf-fortress/twbt/default.nix
+++ b/pkgs/games/dwarf-fortress/twbt/default.nix
@@ -3,12 +3,12 @@
 
 stdenvNoCC.mkDerivation rec {
   name = "twbt-${version}";
-  version = "6.46";
-  dfVersion = "0.44.10";
+  version = "6.49";
+  dfVersion = "0.44.11";
 
   src = fetchurl {
     url = "https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
-    sha256 = "1a4k26z5n547k5j3ij2kx834963rc8vwgwcmbmzmhi893bryb1k6";
+    sha256 = "1qjkc7k33qhxj2g18njzasccjqsis5y8zrw5vl90h4rs3i8ld9xz";
   };
 
   sourceRoot = ".";
diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix
index 0db6ac619633..e58169484987 100644
--- a/pkgs/games/dwarf-fortress/wrapper/default.nix
+++ b/pkgs/games/dwarf-fortress/wrapper/default.nix
@@ -5,6 +5,10 @@
 , enableTWBT ? false, twbt
 , themes ? {}
 , theme ? null
+# General config options:
+, enableIntro ? true
+, enableTruetype ? true
+, enableFPS ? false
 }:
 
 let
@@ -36,11 +40,24 @@ let
     pathsToLink = [ "/" "/hack" "/hack/scripts" ];
     ignoreCollisions = true;
 
-    postBuild = lib.optionalString enableDFHack ''
+    postBuild = ''
+      # De-symlink init.txt
+      cp $out/data/init/init.txt init.txt
+      rm $out/data/init/init.txt
+      mv init.txt $out/data/init/init.txt
+    '' + lib.optionalString enableDFHack ''
       rm $out/hack/symbols.xml
       substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \
         --replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \
                   $(cat ${dwarf-fortress-original}/hash.md5)
+    '' + lib.optionalString enableTWBT ''
+      substituteInPlace $out/data/init/init.txt \
+        --replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
+    '' + ''
+      substituteInPlace $out/data/init/init.txt \
+        --replace '[INTRO:YES]' '[INTRO:${unBool enableIntro}]' \
+        --replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
+        --replace '[FPS:NO]' '[FPS:${unBool enableFPS}]'
     '';
   };
 in