summary refs log tree commit diff
path: root/pkgs/games/dwarf-fortress/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/dwarf-fortress/default.nix')
-rw-r--r--pkgs/games/dwarf-fortress/default.nix115
1 files changed, 80 insertions, 35 deletions
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index aa4ff210812b..88a6d72bc485 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -5,67 +5,112 @@
 # 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 ];`.
+# for instance with:
+#
+# environment.systemPackages = [ pkgs.dwarf-fortress-packages.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.
+# using the other packages here.
+#
+# For example, you can enable the FPS indicator, disable the intro, pick a
+# theme other than phoebus (the default for dwarf-fortress-full), _and_ use
+# an older version with something like:
+#
+# environment.systemPackages = [
+#   (pkgs.dwarf-fortress-packages.dwarf-fortress-full.override {
+#      dfVersion = "0.44.11";
+#      theme = "cla";
+#      enableIntro = false;
+#      enableFPS = true;
+#   })
+# ]
+#
+# Take a look at lazy-pack.nix to see all the other options.
 #
 # 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.
+
+with lib;
 
 let
   callPackage = pkgs.newScope self;
 
-  df-games = lib.listToAttrs (map (dfVersion: {
-    name = "dwarf-fortress_${lib.replaceStrings ["."] ["_"] dfVersion}";
-    value = callPackage ./wrapper {
-      inherit (self) themes;
-      dwarf-fortress = callPackage ./game.nix { inherit dfVersion; };
-    };
-  }) (lib.attrNames self.df-hashes));
+  # The latest Dwarf Fortress version. Maintainers: when a new version comes
+  # out, ensure that (unfuck|dfhack|twbt) are all up to date before changing
+  # this.
+  latestVersion = "0.44.12";
 
-  self = rec {
-    df-hashes = builtins.fromJSON (builtins.readFile ./game.json);
-    dwarf-fortress = df-games.dwarf-fortress_0_44_12;
+  # Converts a version to a package name.
+  versionToName = version: "dwarf-fortress_${lib.replaceStrings ["."] ["_"] version}";
 
-    dwarf-fortress-full = callPackage ./lazy-pack.nix { };
+  # A map of names to each Dwarf Fortress package we know about.
+  df-games = lib.listToAttrs (map (dfVersion: {
+    name = versionToName dfVersion;
+    value =
+      let
+        # I can't believe this syntax works. Spikes of Nix code indeed...
+        dwarf-fortress = callPackage ./game.nix {
+          inherit dfVersion;
+          inherit dwarf-fortress-unfuck;
+        };
 
-    dfhack = callPackage ./dfhack {
-      inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
-      stdenv = gccStdenv;
-    };
+        # unfuck is linux-only right now, we will only use it there.
+        dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { inherit dfVersion; }
+                                else null;
 
-    soundSense = callPackage ./soundsense.nix { };
+        twbt = callPackage ./twbt { inherit dfVersion; };
 
-    # unfuck is linux-only right now, we will only use it there.
-    dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { }
-                            else null;
+        dfhack = callPackage ./dfhack {
+          inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
+          inherit dfVersion twbt;
+          stdenv = gccStdenv;
+        };
 
-    dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix {
-      inherit (dwarf-fortress) dwarf-fortress;
-      dwarf-therapist = pkgs.qt5.callPackage ./dwarf-therapist {
-        texlive = pkgs.texlive.combine {
-          inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
+        dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix {
+          inherit dwarf-fortress;
+          dwarf-therapist = pkgs.qt5.callPackage ./dwarf-therapist {
+            texlive = pkgs.texlive.combine {
+              inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
+            };
+          };
         };
+      in
+      callPackage ./wrapper {
+        inherit (self) themes;
+
+        dwarf-fortress = dwarf-fortress;
+        dwarf-fortress-unfuck = dwarf-fortress-unfuck;
+        twbt = twbt;
+        dfhack = dfhack;
+        dwarf-therapist = dwarf-therapist;
       };
+  }) (lib.attrNames self.df-hashes));
+
+  self = rec {
+    df-hashes = builtins.fromJSON (builtins.readFile ./game.json);
+
+    # Aliases for the latest Dwarf Fortress and the selected Therapist install
+    dwarf-fortress = getAttr (versionToName latestVersion) df-games;
+    dwarf-therapist = dwarf-fortress.dwarf-therapist;
+    dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
+
+    dwarf-fortress-full = callPackage ./lazy-pack.nix {
+      inherit df-games versionToName latestVersion;
     };
+    
+    soundSense = callPackage ./soundsense.nix { };
 
     legends-browser = callPackage ./legends-browser {};
 
-    twbt = callPackage ./twbt {};
-    themes = recurseIntoAttrs (callPackage ./themes { });
+    themes = recurseIntoAttrs (callPackage ./themes {
+      stdenv = stdenvNoCC;
+    });
 
-    # aliases
+    # Theme aliases
     phoebus-theme = themes.phoebus;
     cla-theme = themes.cla;
-    dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
   };
 
 in self // df-games