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 the 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 { useXdgDir = true; } 33``` 34 35## Important note for overriding packages {#important-note-for-overriding-packages} 36 37After applying `overrideAttrs`, you need to fix `passthru.pkgs` and 38`passthru.withMods` attributes either manually or by using `attachPkgs`: 39 40```nix 41let 42 # You enabled parallel building. 43 myCDDA = cataclysm-dda-git.overrideAttrs (_: { 44 enableParallelBuilding = true; 45 }); 46 47 # Unfortunately, this refers to the package before overriding and 48 # parallel building is still disabled. 49 badExample = myCDDA.withMods (_: [ ]); 50 51 inherit (cataclysmDDA) attachPkgs pkgs wrapCDDA; 52 53 # You can fix it by hand 54 goodExample1 = myCDDA.overrideAttrs (old: { 55 passthru = old.passthru // { 56 pkgs = pkgs.override { build = goodExample1; }; 57 withMods = wrapCDDA goodExample1; 58 }; 59 }); 60 61 # or by using a helper function `attachPkgs`. 62 goodExample2 = attachPkgs pkgs myCDDA; 63 64 # badExample # parallel building disabled 65 # goodExample1.withMods (_: []) # parallel building enabled 66in 67goodExample2.withMods (_: [ ]) # parallel building enabled 68``` 69 70## Customizing with mods {#customizing-with-mods} 71 72To install Cataclysm DDA with mods of your choice, you can use `withMods` 73attribute: 74 75```nix 76cataclysm-dda.withMods (mods: with mods; [ tileset.UndeadPeople ]) 77``` 78 79All mods, soundpacks, and tilesets available in nixpkgs are found in 80`cataclysmDDA.pkgs`. 81 82Here is an example to modify existing mods and/or add more mods not available 83in nixpkgs: 84 85```nix 86let 87 customMods = 88 self: super: 89 lib.recursiveUpdate super { 90 # Modify existing mod 91 tileset.UndeadPeople = super.tileset.UndeadPeople.overrideAttrs (old: { 92 # If you like to apply a patch to the tileset for example 93 patches = [ ./path/to/your.patch ]; 94 }); 95 96 # Add another mod 97 mod.Awesome = cataclysmDDA.buildMod { 98 modName = "Awesome"; 99 version = "0.x"; 100 src = fetchFromGitHub { 101 owner = "Someone"; 102 repo = "AwesomeMod"; 103 rev = "..."; 104 hash = "..."; 105 }; 106 # Path to be installed in the unpacked source (default: ".") 107 modRoot = "contents/under/this/path/will/be/installed"; 108 }; 109 110 # Add another soundpack 111 soundpack.Fantastic = cataclysmDDA.buildSoundPack { 112 # ditto 113 }; 114 115 # Add another tileset 116 tileset.SuperDuper = cataclysmDDA.buildTileSet { 117 # ditto 118 }; 119 }; 120in 121cataclysm-dda.withMods ( 122 mods: with mods.extend customMods; [ 123 tileset.UndeadPeople 124 mod.Awesome 125 soundpack.Fantastic 126 tileset.SuperDuper 127 ] 128) 129```