about summary refs log tree commit diff
path: root/home/modules/games.nix
blob: 14b2d1b4b325ca511a3b5e16a90d7d704b5493e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ config, lib, pkgs, ... }:

with pkgs;

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"
     chmod +x $out/bin/dwarf-fortress
  '';

in {
  home.packages = [
    crawl
    df
  ];
}