From aba6a3d7f40d193661c20f723414dcd19a7d768d Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 5 Jul 2018 00:12:38 -0400 Subject: [PATCH 1/4] dwarf-fortress: use fetchFromGitHub directly This avoids creating a second derivation to copy things from the original. The new themes are now fixed output. --- pkgs/games/dwarf-fortress/themes/default.nix | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pkgs/games/dwarf-fortress/themes/default.nix b/pkgs/games/dwarf-fortress/themes/default.nix index 90f46d052618..5caaa9e05ca5 100644 --- a/pkgs/games/dwarf-fortress/themes/default.nix +++ b/pkgs/games/dwarf-fortress/themes/default.nix @@ -4,18 +4,12 @@ with builtins; listToAttrs (map (v: { inherit (v) name; - value = stdenv.mkDerivation { + value = fetchFromGitHub { name = "${v.name}-${v.version}"; - src = fetchFromGitHub { - owner = "DFgraphics"; - repo = v.name; - rev = v.version; - sha256 = v.sha256; - }; - installPhase = '' - mkdir -p $out - cp -r data raw $out - ''; + owner = "DFgraphics"; + repo = v.name; + rev = v.version; + sha256 = v.sha256; meta = with lib; { platforms = platforms.all; maintainers = [ maintainers.matthewbauer ]; From cdd0ac7e5477602289ff8cee94930065e7bc570d Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 5 Jul 2018 17:21:24 -0400 Subject: [PATCH 2/4] dwarf-fortress: support older versions as well game.json now contains a dictionary of old game hashes. I have added them for the last 3 releases. - add script to generate hashes Makes it much easier to update game.json file. - add updateScript meta This adds some info on the ./update.sh updateScript now available. - cleanup updateScript - Add some more systems - Correctly detect source extensions (.zip or .tar.bz2) - Proper bash quoting - fix update.sh - correctly detect latest df version - append to game.json instead of overwriting it - update hashes for 44.12 --- pkgs/games/dwarf-fortress/default.nix | 4 +- pkgs/games/dwarf-fortress/game.json | 86 +++++++++++++++++++++++++++ pkgs/games/dwarf-fortress/game.nix | 58 +++++++++++------- pkgs/games/dwarf-fortress/update.sh | 42 +++++++++++++ 4 files changed, 166 insertions(+), 24 deletions(-) create mode 100644 pkgs/games/dwarf-fortress/game.json create mode 100755 pkgs/games/dwarf-fortress/update.sh diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index b959ea3eda73..480b36f34598 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -4,7 +4,9 @@ let callPackage = pkgs.newScope self; self = rec { - dwarf-fortress-original = callPackage ./game.nix { }; + dwarf-fortress-original = callPackage ./game.nix { + dfVersion = "0.44.11"; + }; dfhack = callPackage ./dfhack { inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT; diff --git a/pkgs/games/dwarf-fortress/game.json b/pkgs/games/dwarf-fortress/game.json new file mode 100644 index 000000000000..05fb0cf50800 --- /dev/null +++ b/pkgs/games/dwarf-fortress/game.json @@ -0,0 +1,86 @@ +{ + "0.43.05": { + "linux": "1r0b96yrdf24m9476k5x7rmp3faxr0kfwwdf35agpvlb1qbi6v45", + "linux32": "16l1lydpkbnl3zhz4i2snmjk7pps8vmw3zv0bjgr8dncbsrycd03", + "osx": "1j2zdkjnmxy8yn599pm0qmbi4zjp1m8h4ggqjxhyzp135h0lqqf9", + "osx32": "09ym4mflp5z78pk5mvj7b44xihnsvrxmh0b5kix6h1m6z3cc90l4", + "win": "0m337wh4c47ij1f3zrimvy7baff7nzrmgjbmrwdy89d0z90xpnx8", + "win_s": "0bjk5m1qkn3ldhqiwbq24y2m9fz9r574d54ngdb8b4ri2xfl1fbp", + "win32": "162rl9ygpj66pis87bqc5bwc0mk75hxv6ianhn87pbl4rh7g8ax8", + "win32_s": "0gv1jyw5fdskjjs27pr41grbmkk7ipqn0ry615f5g79k3mhl200i", + "legacy": "09lvbmg1gq257qchlbmq7hxc5nl9r39jpf73zhmwb5xfbpprn0zs", + "legacy_s": "023a5b27fm65w7gmzjssyyci70fdjk2zbv965y4n0f23kc4rj9gl", + "legacy32": "1m75arxj1q82l2dkk8qcargm3xczxlqi8krwvg3iimddky34gipq", + "legacy32_s": "1hgzsk66isfr5vcraxwgl7cvycl14kwf8w9kzxr8jyp5z7k24q29" + }, + "0.44.05": { + "linux": "18bjyhjp5458bfbizm8vq4s00pqpfs097qp6pv76m84kgbc4ghg3", + "linux32": "1b9i4kf4c8s6bhqwn8jx100mg7fqp8nmswrai5w8dsma01py4amr", + "osx": "1ssc8vq3ad38x9c04j8gg96kxv0g2npi3jwcg40676byx5nrx7b6", + "osx32": "12i7x8idcbvp5h62jyc7b7j98jf4lrisnwglvnrms6jclj0b3g0q", + "win": "1kaifarjx0akg7s5a2ngfw0vm0vyr4jnax5rrbv96dliqn5knddz", + "win_s": "1a1xikrjdv4b0yfgnp5s8d6xn0njylynsqd8zixdc01vccl5kqm6", + "win32": "1j3cq0h7jdvxbsbpfxa7bli45smvy9m4fji0j6849kj7x0vcpwq4", + "win32_s": "10cw1n48ffkrv9ms07ka5b5370d9k2fm051cnnq03lkcvlwrq145", + "legacy": "0y7xpgmwn4nshhc7apyf8mj5ycl0q5vckdaviwzz6w1x31s3dp6n", + "legacy_s": "0j8rbw9ww1avmh8zhyzljjj6in87q4qffpffdl394fsi74n8px0d", + "legacy32": "0d3l4jvx53a01fjf1lf20ar9lfyykfhk05dlrfwz3w4k7vj4vvlf", + "legacy32_s": "1c5x9x44bblz7anhmk4y9a7p1b39b9k7gzvj4pi55jzfq0k60kl7" + }, + "0.44.09": { + "linux": "1haikynkg1pqyrzzqk1qxm19p36ww58qp8brh3fjxssp4x71rcdy", + "linux32": "0lmbrdf7wjdwj5yx0khnq871yxvhfwqxjjyfkqcdy5ik18lvlkj8", + "osx": "01dss8g9lmi8majp6lxcfw166ydz4himkz6am5pi29gixaf4vfqs", + "osx32": "1iwlvmz1ir9k0kzn6726frmkznvsg9a99bbqnxvwcnq3nnnjxw3s", + "win": "08g5irgp59dfjgj3jxc8ixwzgnz2wghcl8cg1b1g4088dsf2x3x8", + "win_s": "1xyb4msn9wfrh7x136r8xn3sjz6z8c4zksbzifa0z0bpa3pdviap", + "win32": "0m8bs2mnyi1r4x84fwnfgd1ijdcf08xsq5zy84476svci932g5kz", + "win32_s": "0pl319qmyy96ibzlgj4wfj19dv1wzyg8ig6q11l4c7rivzc9286i", + "legacy": "0l8nrvppfzazhjsfkd5nd0bxnc6ljk8fs6yg8qh69g7q7zvzgnd3", + "legacy_s": "1c49z539a31czzq0rnhg6yrv1zbaja35sd0ssr4k7lsghjv84k1z", + "legacy32": "155xg6dpb8frlw7d9h7m1y0spw55wl4nkn7zrm70bpyp39pydlqp", + "legacy32_s": "05qkzjfx1ybrv96wya1dirdfxdkhj6a440sjpzwbqpkqgr8z57a3" + }, + "0.44.10": { + "linux": "1cqm43hn3ar9d8a7y7dwq48ajp72cirn1gclh8r2fykkypprxmp2", + "linux32": "0gdb6sq8725nwdisxwha8f5b6arq570s73aj4gdrh611gxh13r6n", + "osx": "1wpa45d81q8f5mhqmaxvdkz93k6cm3pg7vpsqjjjsp5s961gd74g", + "osx32": "0rsy1n19n12gh8rddgi3db32in488f2nizq8kw25hga03hsh4r6x", + "win": "04i0ka12hmn3chsyfmk2pbknr1pdf3p8yaz7kv82ri4g6dvsjfv6", + "win_s": "01m6nqcrz4rhdc8wb31azj3vmjid8bdpqaf9wkz4g4vvjyy7xiyz", + "win32": "1nymin8wbzbh8gm2702dy7h5spdijdxnysdz71ldyl0xx4vw68d9", + "win32_s": "1skz0jpfm6j9bins04kn96f3v3k0kvjqlh25x3129r3hh8xacnd3", + "legacy": "0s84vpfr2b5y1kda9allqjrpkaxw15mkblk9dq08syhsj19vspa7", + "legacy_s": "18b7ikp7xy2y071h3ydfh5mq9hw9y303rdqyikvra5ji3n5p96cm", + "legacy32": "1yh2fl3qwpy6wrxavhn75grbjygymnfh746hxbmc60la7y5flrpy", + "legacy32_s": "0j65w2hxgpccg9qsaz14r82qvnvfd0pbl2gyx9fv8d77kxhkc4pw" + }, + "0.44.11": { + "linux": "1qizfkxl2k6pn70is4vz94q4k55bc3pm13b2r6yqi6lw1cnna4sf", + "linux32": "11m39lfyrsxlw1g7f269q7fzwichg06l21fxhqzgvlvmzmxsf8q5", + "osx": "073hmcj7bm323m3xqi42605rkvmgmv83bnxz1byymgs8aqyfykkx", + "osx32": "0w5avnj86wprk8q0rb5qm9kxbigzk6dk0akqbw4m76jgg2jdmir7", + "win": "1yxyv1sycn5jc3g1y02d82154xydg3kbghis7l3xi28n3bh8387b", + "win_s": "1xzwl6c362wqgps911y9q8vndp8zyd20fc2p7pkzzmw2hrgfqi6q", + "win32": "16x2rg3gm3lh2akg7n057kkxxigb2ljz0nk685lmn4j0adq8l31p", + "win32_s": "1a2y220111d94mzj5y3jwpy062k8fw25akyp7yn3fwa17vwvn8zq", + "legacy": "0gfjmsfqj21hs4d1hm7fvppbdjspc4r2qnnp6mwcbgh67i5p5rdb", + "legacy_s": "1wr4hpzmhgl8haric3jpfd3kwqv1fi4vkb1gvaax5f7kplvfqfac", + "legacy32": "1cpzckwvqkxqn0c498mmh4papsjdi3mcvcp2vzlvj46kvdl3n0f0", + "legacy32_s": "024vzwfcrx7ms4dip0ccwd0vizzck2pwz2ryyvlz4rpjzhswj5gi" + }, + "0.44.12": { + "win32": "0bxrc7zj4vgcgdwc130g6f5jnp13vgx9a2kn2l1jcc958x8a367g", + "linux32": "0fmr8diskmbh12s0bpfn5gky9lmrc7xxj6va5adjm6ahxv9jwr06", + "osx": "1md6r1pimmlhcn5gjqzg0ygbdwc2v125sfjy0f6gbfbykwcm7391", + "osx32": "1dbg7pavxw20r8iqc566fn558avgj5glsycvi6ggbvsh0rpw6n5v", + "win": "0zb5ximqi5j7vyvgjzfz7ycadh5sgb7jlyaa68x0sjlbybdr1min", + "win_s": "1ncf5zr1fggr5knf30l0wh7spp376v1jcc6m9c86zim8azcfx0y7", + "linux": "0ydr5lnysy45nsznqp5r2pysdqn3f0xkrkh9v9l1md111mriabas", + "win32_s": "1mxbjkikf010skrpng51r86jmv4nal51j5n1y9kyhv344bq6chr9", + "legacy": "11a212ynhx18p3k8hvdjx199din14wggxiwz191b4309fznzpprz", + "legacy_s": "05madj529y18ndxrih96mivbzng1vz2zbzicrcnj58i2084zm23f", + "legacy32": "0rapcydiic2nq6idjf7fg53xsxk8dxzyi1vflpz554ghdrnsmwjv", + "legacy32_s": "16fgbd3lx4r270dxqj6gr1g1iqjj8cv389h2hw1l646xx28g8d2m" + } +} diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index 97a94c940cd4..d1264cefe8cd 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -3,36 +3,44 @@ # Our own "unfuck" libs for macOS , ncurses, fmodex, gcc + +, dfVersion }: -with lib; +with lib; with builtins; let - baseVersion = "44"; - patchVersion = "11"; - dfVersion = "0.${baseVersion}.${patchVersion}"; - libpath = makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc dwarf-fortress-unfuck SDL ]; homepage = http://www.bay12games.com/dwarves/; + # Map Dwarf Fortress platform names to Nixpkgs platform names. # Other srcs are avilable like 32-bit mac & win, but I have only # included the ones most likely to be needed by Nixpkgs users. - srcs = { - "x86_64-linux" = fetchurl { - url = "${homepage}df_${baseVersion}_${patchVersion}_linux.tar.bz2"; - sha256 = "1qizfkxl2k6pn70is4vz94q4k55bc3pm13b2r6yqi6lw1cnna4sf"; - }; - "i686-linux" = fetchurl { - url = "${homepage}df_${baseVersion}_${patchVersion}_linux32.tar.bz2"; - sha256 = "11m39lfyrsxlw1g7f269q7fzwichg06l21fxhqzgvlvmzmxsf8q5"; - }; - "x86_64-darwin" = fetchurl { - url = "${homepage}df_${baseVersion}_${patchVersion}_osx.tar.bz2"; - sha256 = "073hmcj7bm323m3xqi42605rkvmgmv83bnxz1byymgs8aqyfykkx"; - }; + platforms = { + "x86_64-linux" = "linux"; + "i686-linux" = "linux32"; + "x86_64-darwin" = "osx"; + "i686-darwin" = "osx32"; + "x86_64-cygwin" = "win"; + "i686-cygwin" = "win32"; }; + dfVersionTriple = splitString "." dfVersion; + baseVersion = elemAt dfVersionTriple 1; + patchVersion = elemAt dfVersionTriple 2; + + games = fromJSON (readFile ./game.json); + game = if hasAttr dfVersion games + then getAttr dfVersion games + else throw "Unknown Dwarf Fortress version: ${dfVersion}"; + dfPlatform = if hasAttr stdenv.system platforms + then getAttr stdenv.system platforms + else throw "Unsupported system: ${stdenv.system}"; + sha256 = if hasAttr dfPlatform game + then getAttr dfPlatform game + else throw "Unsupported dfPlatform: ${dfPlatform}"; + in assert dwarf-fortress-unfuck != null -> @@ -41,9 +49,10 @@ assert dwarf-fortress-unfuck != null -> stdenv.mkDerivation { name = "dwarf-fortress-original-${dfVersion}"; - src = if builtins.hasAttr stdenv.system srcs - then builtins.getAttr stdenv.system srcs - else throw "Unsupported systems"; + src = fetchurl { + url = "${homepage}df_${baseVersion}_${patchVersion}_${dfPlatform}.tar.bz2"; + inherit sha256; + }; installPhase = '' mkdir -p $out @@ -81,13 +90,16 @@ stdenv.mkDerivation { md5sum $exe | awk '{ print $1 }' > $out/hash.md5 ''; - passthru = { inherit baseVersion patchVersion dfVersion; }; + passthru = { + inherit baseVersion patchVersion dfVersion; + updateScript = ./update.sh; + }; meta = { description = "A single-player fantasy game with a randomly generated adventure world"; inherit homepage; license = licenses.unfreeRedistributable; - platforms = attrNames srcs; + platforms = attrNames platforms; maintainers = with maintainers; [ a1russell robbinch roconnor the-kenny abbradar numinit ]; }; } diff --git a/pkgs/games/dwarf-fortress/update.sh b/pkgs/games/dwarf-fortress/update.sh new file mode 100755 index 000000000000..3db68122d358 --- /dev/null +++ b/pkgs/games/dwarf-fortress/update.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p jq nix coreutils curl + +# systems to generate hashes for +systems='linux linux32 osx osx32 + win win_s win32 win32_s + legacy legacy_s legacy32 legacy32_s' + +if [ $# -eq 0 ]; then + versions="$(curl http://www.bay12games.com/dwarves/ \ + | grep 'DOWNLOAD DWARF FORTRESS' \ + | sed 's/.*DOWNLOAD DWARF FORTRESS \([0-9.]*\) .*/\1/')" +else + versions="$@" +fi + +tmp1="$(mktemp)" +tmp2="$(mktemp)" +for version in $versions; do + for system in $systems; do + echo -n $version,$system, + ver=$(echo $version | sed -e s,^0\.,, | tr . _) + if [[ "$system" = *win* ]] || [[ "$system" = *legacy* ]]; then + ext=zip + else + ext=tar.bz2 + fi + nix-prefetch-url \ + http://www.bay12games.com/dwarves/df_${ver}_${system}.${ext} + done +done | jq --slurp --raw-input \ + 'split("\n") | .[:-1] | map(split(",")) | + map({ "version": .[0], "platform": .[1], "sha256": .[2] }) | + group_by(.version) | + map(map({"version": .version, (.platform): .sha256}) | add | + {(.version): .} | map_values(del(.version))) | add' \ + > "$tmp1" + +# Append $tmp1 to game.json. There should be a better way to handle +# this but all other attempts failed for me. +jq -M --argfile a "$tmp1" '. + $a' < "$(dirname "$0")/game.json" > "$tmp2" +cat "$tmp2" > "$(dirname "$0")/game.json" From 530427c7abc7ccff6d1310496c8e6a0362e331ab Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 8 Jul 2018 15:44:29 -0400 Subject: [PATCH 3/4] dwarf-fortress: refactors This will make it easier for people to access old versions. You can now access attributes like: - dwarf-fortress_0_44_11 - dwarf-fortress_0_43_05 - etc. --- pkgs/games/dwarf-fortress/default.nix | 37 +++++++++++-------- .../dwarf-therapist/default.nix | 5 ++- .../dwarf-therapist/wrapper.nix | 19 +++++----- pkgs/games/dwarf-fortress/game.nix | 11 +++--- pkgs/games/dwarf-fortress/wrapper/default.nix | 16 ++++---- 5 files changed, 47 insertions(+), 41 deletions(-) diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index 480b36f34598..1924e0ac846f 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -1,12 +1,19 @@ -{ pkgs, stdenv, stdenvNoCC, gccStdenv }: +{ pkgs, stdenv, stdenvNoCC, gccStdenv, lib }: let callPackage = pkgs.newScope self; - self = rec { - dwarf-fortress-original = callPackage ./game.nix { - dfVersion = "0.44.11"; + 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)); + + self = rec { + df-hashes = builtins.fromJSON (builtins.readFile ./game.json); + dwarf-fortress = df-games.dwarf-fortress_0_44_11; dfhack = callPackage ./dfhack { inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT; @@ -17,29 +24,27 @@ let # unfuck is linux-only right now, we will just use it there dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { } - else null; + else null; - dwarf-fortress = callPackage ./wrapper { - inherit themes; - }; - - dwarf-therapist-original = 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-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 { }; - legends-browser = callPackage ./legends-browser {}; themes = callPackage ./themes { stdenv = stdenvNoCC; }; + # aliases phoebus-theme = themes.phoebus; - cla-theme = themes.cla; + dwarf-fortress-original = dwarf-fortress.dwarf-fortress; }; -in self +in self // df-games diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix index bd63e3eae91f..5e92bbb285b8 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix @@ -1,7 +1,8 @@ -{ stdenv, fetchFromGitHub, coreutils, qtbase, qtdeclarative, cmake, texlive, ninja }: +{ stdenv, fetchFromGitHub, coreutils, qtbase +, qtdeclarative, cmake, texlive, ninja }: stdenv.mkDerivation rec { - name = "dwarf-therapist-original-${version}"; + name = "dwarf-therapist-${version}"; version = "40.1.0"; src = fetchFromGitHub { diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix index f9e3e468cdc0..334c7ebbf6fc 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -1,20 +1,19 @@ -{ stdenv, symlinkJoin, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }: +{ stdenv, symlinkJoin, lib, dwarf-therapist, dwarf-fortress, makeWrapper }: let - df = dwarf-fortress-original; - dt = dwarf-therapist-original; platformSlug = if stdenv.targetPlatform.is32bit then "linux32" else "linux64"; - inifile = "linux/v0.${df.baseVersion}.${df.patchVersion}_${platformSlug}.ini"; - dfHashFile = "${df}/hash.md5"; + inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini"; in symlinkJoin { - name = "dwarf-therapist-${dt.version}"; + name = "dwarf-therapist-${dwarf-therapist.version}"; - paths = [ dt ]; + paths = [ dwarf-therapist ]; buildInputs = [ makeWrapper ]; + passthru = { inherit dwarf-fortress dwarf-therapist; }; + postBuild = '' # DwarfTherapist assumes it's run in $out/share/dwarftherapist and # therefore uses many relative paths. @@ -23,10 +22,10 @@ in symlinkJoin { rm -rf $out/share/dwarftherapist/memory_layouts/linux mkdir -p $out/share/dwarftherapist/memory_layouts/linux - origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8) - patchedmd5=$(cat "${dfHashFile}" | cut -c1-8) + origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8) + patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8) substitute \ - ${dt}/share/dwarftherapist/memory_layouts/${inifile} \ + ${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \ $out/share/dwarftherapist/memory_layouts/${inifile} \ --replace "$origmd5" "$patchedmd5" ''; diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix index d1264cefe8cd..f57e9703fabf 100644 --- a/pkgs/games/dwarf-fortress/game.nix +++ b/pkgs/games/dwarf-fortress/game.nix @@ -4,10 +4,10 @@ # Our own "unfuck" libs for macOS , ncurses, fmodex, gcc -, dfVersion +, dfVersion, df-hashes }: -with lib; with builtins; +with lib; let libpath = makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc dwarf-fortress-unfuck SDL ]; @@ -30,9 +30,8 @@ let baseVersion = elemAt dfVersionTriple 1; patchVersion = elemAt dfVersionTriple 2; - games = fromJSON (readFile ./game.json); - game = if hasAttr dfVersion games - then getAttr dfVersion games + game = if hasAttr dfVersion df-hashes + then getAttr dfVersion df-hashes else throw "Unknown Dwarf Fortress version: ${dfVersion}"; dfPlatform = if hasAttr stdenv.system platforms then getAttr stdenv.system platforms @@ -47,7 +46,7 @@ assert dwarf-fortress-unfuck != null -> dwarf-fortress-unfuck.dfVersion == dfVersion; stdenv.mkDerivation { - name = "dwarf-fortress-original-${dfVersion}"; + name = "dwarf-fortress-${dfVersion}"; src = fetchurl { url = "${homepage}df_${baseVersion}_${patchVersion}_${dfPlatform}.tar.bz2"; diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix index 9b171fc88b76..62c15394565f 100644 --- a/pkgs/games/dwarf-fortress/wrapper/default.nix +++ b/pkgs/games/dwarf-fortress/wrapper/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, buildEnv, dwarf-fortress-original, substituteAll +{ stdenv, lib, buildEnv, dwarf-fortress, substituteAll , enableDFHack ? false, dfhack , enableSoundSense ? false, soundSense, jdk , enableStoneSense ? false @@ -20,10 +20,10 @@ let themePkg = lib.optional (theme != null) ptheme; pkgs = lib.optional enableDFHack dfhack_ ++ lib.optional enableSoundSense soundSense - ++ [ dwarf-fortress-original ]; + ++ [ dwarf-fortress ]; env = buildEnv { - name = "dwarf-fortress-env-${dwarf-fortress-original.dfVersion}"; + name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}"; paths = themePkg ++ pkgs; pathsToLink = [ "/" "/hack" "/hack/scripts" ]; @@ -32,16 +32,16 @@ let postBuild = lib.optionalString enableDFHack '' rm $out/hack/symbols.xml substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \ - --replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \ - $(cat ${dwarf-fortress-original}/hash.md5) + --replace $(cat ${dwarf-fortress}/hash.md5.orig) \ + $(cat ${dwarf-fortress}/hash.md5) ''; }; in stdenv.mkDerivation rec { - name = "dwarf-fortress-${dwarf-fortress-original.dfVersion}"; + name = "dwarf-fortress-${dwarf-fortress.dfVersion}"; - compatible = lib.all (x: assert (x.dfVersion == dwarf-fortress-original.dfVersion); true) pkgs; + compatible = lib.all (x: assert (x.dfVersion == dwarf-fortress.dfVersion); true) pkgs; dfInit = substituteAll { name = "dwarf-fortress-init"; @@ -55,6 +55,8 @@ stdenv.mkDerivation rec { runDFHack = ./dfhack.in; runSoundSense = ./soundSense.in; + passthru = { inherit dwarf-fortress; }; + buildCommand = '' mkdir -p $out/bin From 812b0ec62e0054e647fbb6b6f716bd4c4515bacb Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 9 Jul 2018 16:18:17 -0400 Subject: [PATCH 4/4] dwarf-fortress: recurse into themes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now the output of “nix-env” should be: $ nix-env -qa -f . -A dwarf-fortress-packages afro-graphics-44.10 autoreiv-44.03 cla-44.xx-v25 dwarf-fortress-0.43.05 dwarf-fortress-0.44.05 dwarf-fortress-0.44.09 dwarf-fortress-0.44.10 dwarf-fortress-0.44.11 dwarf-fortress-0.44.12 dwarf-therapist-40.1.0 gemset-44.10a ironhand-44.10 jolly-bastion-44.10 legends-browser-1.17.1 mayday-44.10 obsidian-44.10 phoebus-44.10 rally-ho-44.10 soundsense-2016-1_196 spacefox-44.10a taffer-44.10a tergel-44.03 wanderlust-44.10 --- pkgs/games/dwarf-fortress/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index 1924e0ac846f..218cf4309861 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -1,4 +1,4 @@ -{ pkgs, stdenv, stdenvNoCC, gccStdenv, lib }: +{ pkgs, stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs }: let callPackage = pkgs.newScope self; @@ -37,9 +37,9 @@ let legends-browser = callPackage ./legends-browser {}; - themes = callPackage ./themes { + themes = recurseIntoAttrs (callPackage ./themes { stdenv = stdenvNoCC; - }; + }); # aliases phoebus-theme = themes.phoebus;