about summary refs log tree commit diff
path: root/users/glittershark/system/home/modules/games.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-16T00·02+0100
committerVincent Ambo <mail@tazj.in>2020-06-16T00·02+0100
commit81564185e951f69d490be8f5ad76e8ea642b5dde (patch)
treec27cd8a5bb922f710ff7da4b2942d2db09a95376 /users/glittershark/system/home/modules/games.nix
parent85d82a9dc262bffa87423f595f7e957c42713798 (diff)
parent3b174300ae60f63f50427cde3bfd680fd3043c3a (diff)
Add 'users/glittershark/system/' from commit '3b174300ae60f63f50427cde3bfd680fd3043c3a' r/975
git-subtree-dir: users/glittershark/system
git-subtree-mainline: 85d82a9dc262bffa87423f595f7e957c42713798
git-subtree-split: 3b174300ae60f63f50427cde3bfd680fd3043c3a
Diffstat (limited to 'users/glittershark/system/home/modules/games.nix')
-rw-r--r--users/glittershark/system/home/modules/games.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/users/glittershark/system/home/modules/games.nix b/users/glittershark/system/home/modules/games.nix
new file mode 100644
index 000000000000..a9adf9c91036
--- /dev/null
+++ b/users/glittershark/system/home/modules/games.nix
@@ -0,0 +1,58 @@
+{ config, lib, pkgs, ... }:
+
+with pkgs;
+with lib;
+
+let
+
+  df-orig = dwarf-fortress-packages.dwarf-fortress-original;
+
+  df-full = (dwarf-fortress-packages.dwarf-fortress-full.override {
+    theme = null;
+    enableIntro = false;
+    enableFPS = true;
+  });
+
+  init = runCommand "init.txt" {} ''
+    substitute "${df-orig}/data/init/init.txt" $out \
+      --replace "[INTRO:YES]" "[INTRO:NO]" \
+      --replace "[VOLUME:255]" "[VOLUME:0]" \
+      --replace "[FPS:NO]" "[FPS:YES]"
+  '';
+
+  d_init = runCommand "d_init.txt" {} ''
+    substitute "${df-orig}/data/init/d_init.txt" $out \
+      --replace "[AUTOSAVE:NONE]" "[AUTOSAVE:SEASONAL]" \
+      --replace "[AUTOSAVE_PAUSE:NO]" "[AUTOSAVE_PAUSE:YES]" \
+      --replace "[INITIAL_SAVE:NO]" "[INITIAL_SAVE:YES]" \
+      --replace "[EMBARK_WARNING_ALWAYS:NO]" "[EMBARK_WARNING_ALWAYS:YES]" \
+      --replace "[VARIED_GROUND_TILES:YES]" "[VARIED_GROUND_TILES:NO]" \
+      --replace "[SHOW_FLOW_AMOUNTS:NO]" "[SHOW_FLOW_AMOUNTS:YES]"
+  '';
+
+  df = runCommand "dwarf-fortress" {} ''
+    mkdir -p $out/bin
+    sed \
+      -e '4icp -f ${init} "$DF_DIR/data/init/init.txt"' \
+      -e '4icp -f ${d_init} "$DF_DIR/data/init/d_init.txt"' \
+      < "${df-full}/bin/dwarf-fortress" >"$out/bin/dwarf-fortress"
+
+    shopt -s extglob
+    ln -s ${df-full}/bin/!(dwarf-fortress) $out/bin
+
+    chmod +x $out/bin/dwarf-fortress
+  '';
+
+in mkMerge [
+  {
+    home.packages = [
+      crawl
+    ];
+  }
+  (mkIf stdenv.isLinux {
+    home.packages = [
+      df
+    ];
+  })
+]
+