1# Cataclysm: Dark Days Ahead {#cataclysm-dark-days-ahead} 2 3## How to install Cataclysm DDA {#how-to-install-cataclysm-dda} 4 5To install the latest stable release of Cataclysm DDA to your profile, execute 6`nix-env -f "<nixpkgs>" -iA cataclysm-dda`. For the curses build (build 7without tiles), install `cataclysmDDA.stable.curses`. Note: `cataclysm-dda` is 8an alias to `cataclysmDDA.stable.tiles`. 9 10If you like access to a development build of your favorite git revision, 11override `cataclysm-dda-git` (or `cataclysmDDA.git.curses` if you like curses 12build): 13 14```nix 15cataclysm-dda-git.override { 16 version = "YYYY-MM-DD"; 17 rev = "YOUR_FAVORITE_REVISION"; 18 sha256 = "CHECKSUM_OF_THE_REVISION"; 19} 20``` 21 22The sha256 checksum can be obtained by 23 24```sh 25nix-prefetch-url --unpack "https://github.com/CleverRaven/Cataclysm-DDA/archive/${YOUR_FAVORITE_REVISION}.tar.gz" 26``` 27 28The default configuration directory is `~/.cataclysm-dda`. If you prefer 29`$XDG_CONFIG_HOME/cataclysm-dda`, override the derivation: 30 31```nix 32cataclysm-dda.override { 33 useXdgDir = true; 34} 35``` 36 37## Important note for overriding packages {#important-note-for-overriding-packages} 38 39After applying `overrideAttrs`, you need to fix `passthru.pkgs` and 40`passthru.withMods` attributes either manually or by using `attachPkgs`: 41 42```nix 43let 44 # You enabled parallel building. 45 myCDDA = cataclysm-dda-git.overrideAttrs (_: { 46 enableParallelBuilding = true; 47 }); 48 49 # Unfortunately, this refers to the package before overriding and 50 # parallel building is still disabled. 51 badExample = myCDDA.withMods (_: []); 52 53 inherit (cataclysmDDA) attachPkgs pkgs wrapCDDA; 54 55 # You can fix it by hand 56 goodExample1 = myCDDA.overrideAttrs (old: { 57 passthru = old.passthru // { 58 pkgs = pkgs.override { build = goodExample1; }; 59 withMods = wrapCDDA goodExample1; 60 }; 61 }); 62 63 # or by using a helper function `attachPkgs`. 64 goodExample2 = attachPkgs pkgs myCDDA; 65in 66 67# badExample # parallel building disabled 68# goodExample1.withMods (_: []) # parallel building enabled 69goodExample2.withMods (_: []) # parallel building enabled 70``` 71 72## Customizing with mods {#customizing-with-mods} 73 74To install Cataclysm DDA with mods of your choice, you can use `withMods` 75attribute: 76 77```nix 78cataclysm-dda.withMods (mods: with mods; [ 79 tileset.UndeadPeople 80]) 81``` 82 83All mods, soundpacks, and tilesets available in nixpkgs are found in 84`cataclysmDDA.pkgs`. 85 86Here is an example to modify existing mods and/or add more mods not available 87in nixpkgs: 88 89```nix 90let 91 customMods = self: super: lib.recursiveUpdate super { 92 # Modify existing mod 93 tileset.UndeadPeople = super.tileset.UndeadPeople.overrideAttrs (old: { 94 # If you like to apply a patch to the tileset for example 95 patches = [ ./path/to/your.patch ]; 96 }); 97 98 # Add another mod 99 mod.Awesome = cataclysmDDA.buildMod { 100 modName = "Awesome"; 101 version = "0.x"; 102 src = fetchFromGitHub { 103 owner = "Someone"; 104 repo = "AwesomeMod"; 105 rev = "..."; 106 hash = "..."; 107 }; 108 # Path to be installed in the unpacked source (default: ".") 109 modRoot = "contents/under/this/path/will/be/installed"; 110 }; 111 112 # Add another soundpack 113 soundpack.Fantastic = cataclysmDDA.buildSoundPack { 114 # ditto 115 }; 116 117 # Add another tileset 118 tileset.SuperDuper = cataclysmDDA.buildTileSet { 119 # ditto 120 }; 121 }; 122in 123cataclysm-dda.withMods (mods: with mods.extend customMods; [ 124 tileset.UndeadPeople 125 mod.Awesome 126 soundpack.Fantastic 127 tileset.SuperDuper 128]) 129```