dwarf-fortress: refactor

authored by

Artturin and committed by
Jonathan Ringer
cd3ed54f 4e75706a

+248 -147
+43 -39
pkgs/games/dwarf-fortress/default.nix
··· 1 - { pkgs, stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs }: 2 3 # To whomever it may concern: 4 # ··· 35 with lib; 36 37 let 38 - callPackage = pkgs.newScope self; 39 40 # The latest Dwarf Fortress version. Maintainers: when a new version comes 41 # out, ensure that (unfuck|dfhack|twbt) are all up to date before changing ··· 45 # Converts a version to a package name. 46 versionToName = version: "dwarf-fortress_${lib.replaceStrings ["."] ["_"] version}"; 47 48 - dwarf-therapist-original = pkgs.qt5.callPackage ./dwarf-therapist { 49 - texlive = pkgs.texlive.combine { 50 - inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem; 51 }; 52 }; 53 54 # A map of names to each Dwarf Fortress package we know about. 55 - df-games = lib.listToAttrs (map (dfVersion: { 56 - name = versionToName dfVersion; 57 - value = 58 - let 59 - # I can't believe this syntax works. Spikes of Nix code indeed... 60 - dwarf-fortress = callPackage ./game.nix { 61 - inherit dfVersion; 62 - inherit dwarf-fortress-unfuck; 63 - }; 64 65 - # unfuck is linux-only right now, we will only use it there. 66 - dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { inherit dfVersion; } 67 - else null; 68 69 - twbt = callPackage ./twbt { inherit dfVersion; }; 70 71 - dfhack = callPackage ./dfhack { 72 - inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT; 73 - inherit dfVersion twbt; 74 - stdenv = gccStdenv; 75 - }; 76 77 - dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix { 78 - inherit dwarf-fortress; 79 - dwarf-therapist = dwarf-therapist-original; 80 - }; 81 - in 82 - callPackage ./wrapper { 83 - inherit (self) themes; 84 85 - dwarf-fortress = dwarf-fortress; 86 - twbt = twbt; 87 - dfhack = dfhack; 88 - dwarf-therapist = dwarf-therapist; 89 90 - jdk = pkgs.jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 91 - }; 92 - }) (lib.attrNames self.df-hashes)); 93 94 self = rec { 95 df-hashes = builtins.fromJSON (builtins.readFile ./game.json); ··· 107 soundSense = callPackage ./soundsense.nix { }; 108 109 legends-browser = callPackage ./legends-browser { 110 - jre = pkgs.jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 111 }; 112 113 themes = recurseIntoAttrs (callPackage ./themes { ··· 119 cla-theme = themes.cla; 120 }; 121 122 - in self // df-games
··· 1 + { stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs, libsForQt5, newScope, texlive, perlPackages, jdk8, jre8 }: 2 3 # To whomever it may concern: 4 # ··· 35 with lib; 36 37 let 38 + callPackage = newScope self; 39 40 # The latest Dwarf Fortress version. Maintainers: when a new version comes 41 # out, ensure that (unfuck|dfhack|twbt) are all up to date before changing ··· 45 # Converts a version to a package name. 46 versionToName = version: "dwarf-fortress_${lib.replaceStrings ["."] ["_"] version}"; 47 48 + dwarf-therapist-original = libsForQt5.callPackage ./dwarf-therapist { 49 + texlive = texlive.combine { 50 + inherit (texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem; 51 }; 52 }; 53 54 # A map of names to each Dwarf Fortress package we know about. 55 + df-games = lib.listToAttrs (map 56 + (dfVersion: { 57 + name = versionToName dfVersion; 58 + value = 59 + let 60 + # I can't believe this syntax works. Spikes of Nix code indeed... 61 + dwarf-fortress = callPackage ./game.nix { 62 + inherit dfVersion; 63 + inherit dwarf-fortress-unfuck; 64 + }; 65 66 + # unfuck is linux-only right now, we will only use it there. 67 + dwarf-fortress-unfuck = 68 + if stdenv.isLinux then callPackage ./unfuck.nix { inherit dfVersion; } 69 + else null; 70 71 + twbt = callPackage ./twbt { inherit dfVersion; }; 72 73 + dfhack = callPackage ./dfhack { 74 + inherit (perlPackages) XMLLibXML XMLLibXSLT; 75 + inherit dfVersion twbt; 76 + stdenv = gccStdenv; 77 + }; 78 79 + dwarf-therapist = libsForQt5.callPackage ./dwarf-therapist/wrapper.nix { 80 + inherit dwarf-fortress; 81 + dwarf-therapist = dwarf-therapist-original; 82 + }; 83 + in 84 + callPackage ./wrapper { 85 + inherit (self) themes; 86 87 + dwarf-fortress = dwarf-fortress; 88 + twbt = twbt; 89 + dfhack = dfhack; 90 + dwarf-therapist = dwarf-therapist; 91 92 + jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 93 + }; 94 + }) 95 + (lib.attrNames self.df-hashes)); 96 97 self = rec { 98 df-hashes = builtins.fromJSON (builtins.readFile ./game.json); ··· 110 soundSense = callPackage ./soundsense.nix { }; 111 112 legends-browser = callPackage ./legends-browser { 113 + jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 114 }; 115 116 themes = recurseIntoAttrs (callPackage ./themes { ··· 122 cla-theme = themes.cla; 123 }; 124 125 + in 126 + self // df-games
+23 -9
pkgs/games/dwarf-fortress/dfhack/default.nix
··· 1 - { stdenv, buildEnv, lib, fetchFromGitHub, cmake, writeScriptBin 2 - , perl, XMLLibXML, XMLLibXSLT, zlib, ruby 3 - , enableStoneSense ? false, allegro5, libGLU, libGL 4 - , enableTWBT ? true, twbt 5 , SDL 6 , dfVersion 7 }: ··· 60 }; 61 }; 62 63 - release = if hasAttr dfVersion dfhack-releases 64 - then getAttr dfVersion dfhack-releases 65 - else throw "[DFHack] Unsupported Dwarf Fortress version: ${dfVersion}"; 66 67 version = release.dfHackRelease; 68 ··· 125 nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ]; 126 # We don't use system libraries because dfhack needs old C++ ABI. 127 buildInputs = [ zlib SDL ] 128 - ++ lib.optionals enableStoneSense [ allegro5 libGLU libGL ]; 129 130 preConfigure = '' 131 # Trick build system into believing we have .git ··· 138 ''; 139 140 cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ] 141 - ++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ]; 142 143 # dfhack expects an unversioned libruby.so to be present in the hack 144 # subdirectory for ruby plugins to function.
··· 1 + { stdenv 2 + , buildEnv 3 + , lib 4 + , fetchFromGitHub 5 + , cmake 6 + , writeScriptBin 7 + , perl 8 + , XMLLibXML 9 + , XMLLibXSLT 10 + , zlib 11 + , ruby 12 + , enableStoneSense ? false 13 + , allegro5 14 + , libGLU 15 + , libGL 16 + , enableTWBT ? true 17 + , twbt 18 , SDL 19 , dfVersion 20 }: ··· 73 }; 74 }; 75 76 + release = 77 + if hasAttr dfVersion dfhack-releases 78 + then getAttr dfVersion dfhack-releases 79 + else throw "[DFHack] Unsupported Dwarf Fortress version: ${dfVersion}"; 80 81 version = release.dfHackRelease; 82 ··· 139 nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ]; 140 # We don't use system libraries because dfhack needs old C++ ABI. 141 buildInputs = [ zlib SDL ] 142 + ++ lib.optionals enableStoneSense [ allegro5 libGLU libGL ]; 143 144 preConfigure = '' 145 # Trick build system into believing we have .git ··· 152 ''; 153 154 cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ] 155 + ++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ]; 156 157 # dfhack expects an unversioned libruby.so to be present in the hack 158 # subdirectory for ruby plugins to function.
+14 -6
pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, qtbase 2 - , qtdeclarative, cmake, texlive, ninja }: 3 4 stdenv.mkDerivation rec { 5 pname = "dwarf-therapist"; ··· 15 nativeBuildInputs = [ texlive cmake ninja ]; 16 buildInputs = [ qtbase qtdeclarative ]; 17 18 - installPhase = if stdenv.isDarwin then '' 19 - mkdir -p $out/Applications 20 - cp -r DwarfTherapist.app $out/Applications 21 - '' else null; 22 23 dontWrapQtApps = true; 24
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , qtbase 5 + , qtdeclarative 6 + , cmake 7 + , texlive 8 + , ninja 9 + }: 10 11 stdenv.mkDerivation rec { 12 pname = "dwarf-therapist"; ··· 22 nativeBuildInputs = [ texlive cmake ninja ]; 23 buildInputs = [ qtbase qtdeclarative ]; 24 25 + installPhase = 26 + if stdenv.isDarwin then '' 27 + mkdir -p $out/Applications 28 + cp -r DwarfTherapist.app $out/Applications 29 + '' else null; 30 31 dontWrapQtApps = true; 32
+5 -6
pkgs/games/dwarf-fortress/dwarf-therapist/dwarf-therapist.in
··· 5 install_dir="@install@" 6 therapist_dir="@therapist@" 7 8 - cat <<EOF >&2 9 Using $DT_DIR as Dwarf Therapist overlay directory. 10 EOF 11 12 update_path() { 13 local path="$1" 14 15 - mkdir -p "$DT_DIR/$(dirname "$path")" 16 if [ ! -e "$DT_DIR/$path" ] || [ -L "$DT_DIR/$path" ]; then 17 - rm -f "$DT_DIR/$path" 18 - ln -s "$install_dir/share/dwarftherapist/$path" "$DT_DIR/$path" 19 fi 20 } 21 22 cd "$install_dir/share/dwarftherapist" 23 update_path memory_layouts 24 25 - QT_QPA_PLATFORM_PLUGIN_PATH="@qt_plugin_path@" \ 26 - exec "$therapist_dir/bin/dwarftherapist" "$@"
··· 5 install_dir="@install@" 6 therapist_dir="@therapist@" 7 8 + @cat@ <<EOF >&2 9 Using $DT_DIR as Dwarf Therapist overlay directory. 10 EOF 11 12 update_path() { 13 local path="$1" 14 15 + @mkdir@ -p "$DT_DIR/$(@dirname@ "$path")" 16 if [ ! -e "$DT_DIR/$path" ] || [ -L "$DT_DIR/$path" ]; then 17 + @rm@ -f "$DT_DIR/$path" 18 + @ln@ -s "$install_dir/share/dwarftherapist/$path" "$DT_DIR/$path" 19 fi 20 } 21 22 cd "$install_dir/share/dwarftherapist" 23 update_path memory_layouts 24 25 + exec "$therapist_dir/bin/dwarftherapist" "$@"
+20 -11
pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
··· 1 - { pkgs, stdenv, dwarf-therapist, dwarf-fortress, makeWrapper }: 2 3 let 4 - platformSlug = if stdenv.targetPlatform.is32bit then 5 - "linux32" else "linux64"; 6 inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini"; 7 8 in ··· 10 stdenv.mkDerivation { 11 name = "dwarf-therapist-${dwarf-therapist.version}"; 12 13 - wrapper = ./dwarf-therapist.in; 14 15 paths = [ dwarf-therapist ]; 16 17 - nativeBuildInputs = [ makeWrapper ]; 18 19 passthru = { inherit dwarf-fortress dwarf-therapist; }; 20 21 buildCommand = '' 22 mkdir -p $out/bin 23 ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist 24 - substitute $wrapper $out/bin/dwarftherapist \ 25 - --subst-var-by stdenv_shell ${stdenv.shell} \ 26 - --subst-var-by install $out \ 27 - --subst-var-by therapist ${dwarf-therapist} \ 28 - --subst-var-by qt_plugin_path "${pkgs.qt5.qtbase}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins/platforms" 29 30 - chmod 755 $out/bin/dwarftherapist 31 32 # Fix up memory layouts 33 rm -rf $out/share/dwarftherapist/memory_layouts/linux
··· 1 + { stdenv, dwarf-therapist, dwarf-fortress, substituteAll, coreutils, wrapQtAppsHook }: 2 3 let 4 + platformSlug = 5 + if stdenv.targetPlatform.is32bit then 6 + "linux32" else "linux64"; 7 inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini"; 8 9 in ··· 11 stdenv.mkDerivation { 12 name = "dwarf-therapist-${dwarf-therapist.version}"; 13 14 + wrapper = substituteAll { 15 + src = ./dwarf-therapist.in; 16 + stdenv_shell = "${stdenv.shell}"; 17 + rm = "${coreutils}/bin/rm"; 18 + ln = "${coreutils}/bin/ln"; 19 + cat = "${coreutils}/bin/cat"; 20 + mkdir = "${coreutils}/bin/mkdir"; 21 + dirname = "${coreutils}/bin/dirname"; 22 + therapist = "${dwarf-therapist}"; 23 + }; 24 25 paths = [ dwarf-therapist ]; 26 27 + nativeBuildInputs = [ wrapQtAppsHook ]; 28 29 passthru = { inherit dwarf-fortress dwarf-therapist; }; 30 31 buildCommand = '' 32 mkdir -p $out/bin 33 + 34 + install -Dm755 $wrapper $out/bin/dwarftherapist 35 ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist 36 37 + substituteInPlace $out/bin/dwarftherapist \ 38 + --subst-var-by install $out 39 + wrapQtApp $out/bin/dwarftherapist 40 41 # Fix up memory layouts 42 rm -rf $out/share/dwarftherapist/memory_layouts/linux
+23 -14
pkgs/games/dwarf-fortress/game.nix
··· 1 - { stdenv, lib, fetchurl 2 - , SDL, dwarf-fortress-unfuck 3 4 - # Our own "unfuck" libs for macOS 5 - , ncurses, fmodex, gcc 6 7 - , dfVersion, df-hashes 8 }: 9 10 with lib; ··· 30 baseVersion = elemAt dfVersionTriple 1; 31 patchVersion = elemAt dfVersionTriple 2; 32 33 - game = if hasAttr dfVersion df-hashes 34 - then getAttr dfVersion df-hashes 35 - else throw "Unknown Dwarf Fortress version: ${dfVersion}"; 36 - dfPlatform = if hasAttr stdenv.hostPlatform.system platforms 37 - then getAttr stdenv.hostPlatform.system platforms 38 - else throw "Unsupported system: ${stdenv.hostPlatform.system}"; 39 - sha256 = if hasAttr dfPlatform game 40 - then getAttr dfPlatform game 41 - else throw "Unsupported dfPlatform: ${dfPlatform}"; 42 43 in 44
··· 1 + { stdenv 2 + , lib 3 + , fetchurl 4 + , SDL 5 + , dwarf-fortress-unfuck 6 7 + # Our own "unfuck" libs for macOS 8 + , ncurses 9 + , fmodex 10 + , gcc 11 12 + , dfVersion 13 + , df-hashes 14 }: 15 16 with lib; ··· 36 baseVersion = elemAt dfVersionTriple 1; 37 patchVersion = elemAt dfVersionTriple 2; 38 39 + game = 40 + if hasAttr dfVersion df-hashes 41 + then getAttr dfVersion df-hashes 42 + else throw "Unknown Dwarf Fortress version: ${dfVersion}"; 43 + dfPlatform = 44 + if hasAttr stdenv.hostPlatform.system platforms 45 + then getAttr stdenv.hostPlatform.system platforms 46 + else throw "Unsupported system: ${stdenv.hostPlatform.system}"; 47 + sha256 = 48 + if hasAttr dfPlatform game 49 + then getAttr dfPlatform game 50 + else throw "Unsupported dfPlatform: ${dfPlatform}"; 51 52 in 53
+19 -11
pkgs/games/dwarf-fortress/lazy-pack.nix
··· 1 - { stdenvNoCC, lib, buildEnv 2 - , df-games, themes, latestVersion, versionToName 3 , dfVersion ? latestVersion 4 # This package should, at any given time, provide an opinionated "optimal" 5 # DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and ··· 9 , enableSoundSense ? true 10 , enableStoneSense ? true 11 , enableDwarfTherapist ? true 12 - , enableLegendsBrowser ? true, legends-browser 13 , theme ? themes.phoebus 14 - # General config options: 15 , enableIntro ? true 16 , enableTruetype ? true 17 , enableFPS ? false ··· 23 24 let 25 dfGame = versionToName dfVersion; 26 - dwarf-fortress = if hasAttr dfGame df-games 27 - then getAttr dfGame df-games 28 - else throw "Unknown Dwarf Fortress version: ${dfVersion}"; 29 dwarf-therapist = dwarf-fortress.dwarf-therapist; 30 in 31 buildEnv { ··· 33 paths = [ 34 (dwarf-fortress.override { 35 inherit enableDFHack enableTWBT enableSoundSense enableStoneSense theme 36 - enableIntro enableTruetype enableFPS enableTextMode enableSound; 37 - })] 38 - ++ lib.optional enableDwarfTherapist dwarf-therapist 39 - ++ lib.optional enableLegendsBrowser legends-browser; 40 41 meta = with lib; { 42 description = "An opinionated wrapper for Dwarf Fortress";
··· 1 + { stdenvNoCC 2 + , lib 3 + , buildEnv 4 + , df-games 5 + , themes 6 + , latestVersion 7 + , versionToName 8 , dfVersion ? latestVersion 9 # This package should, at any given time, provide an opinionated "optimal" 10 # DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and ··· 14 , enableSoundSense ? true 15 , enableStoneSense ? true 16 , enableDwarfTherapist ? true 17 + , enableLegendsBrowser ? true 18 + , legends-browser 19 , theme ? themes.phoebus 20 + # General config options: 21 , enableIntro ? true 22 , enableTruetype ? true 23 , enableFPS ? false ··· 29 30 let 31 dfGame = versionToName dfVersion; 32 + dwarf-fortress = 33 + if hasAttr dfGame df-games 34 + then getAttr dfGame df-games 35 + else throw "Unknown Dwarf Fortress version: ${dfVersion}"; 36 dwarf-therapist = dwarf-fortress.dwarf-therapist; 37 in 38 buildEnv { ··· 40 paths = [ 41 (dwarf-fortress.override { 42 inherit enableDFHack enableTWBT enableSoundSense enableStoneSense theme 43 + enableIntro enableTruetype enableFPS enableTextMode enableSound; 44 + }) 45 + ] 46 + ++ lib.optional enableDwarfTherapist dwarf-therapist 47 + ++ lib.optional enableLegendsBrowser legends-browser; 48 49 meta = with lib; { 50 description = "An opinionated wrapper for Dwarf Fortress";
+5 -2
pkgs/games/dwarf-fortress/soundsense.nix
··· 1 - { stdenv, fetchzip, dos2unix 2 , soundPack ? stdenv.mkDerivation { 3 name = "soundsense-soundpack"; 4 src = fetchzip { ··· 8 installPhase = '' 9 cp -r . $out 10 ''; 11 - }}: 12 13 stdenv.mkDerivation rec { 14 version = "2016-1_196";
··· 1 + { stdenv 2 + , fetchzip 3 + , dos2unix 4 , soundPack ? stdenv.mkDerivation { 5 name = "soundsense-soundpack"; 6 src = fetchzip { ··· 10 installPhase = '' 11 cp -r . $out 12 ''; 13 + } 14 + }: 15 16 stdenv.mkDerivation rec { 17 version = "2016-1_196";
+17 -15
pkgs/games/dwarf-fortress/themes/default.nix
··· 1 - {lib, fetchFromGitHub, ...}: 2 3 with builtins; 4 5 - listToAttrs (map (v: { 6 - inherit (v) name; 7 - value = fetchFromGitHub { 8 - name = "${v.name}-${v.version}"; 9 - owner = "DFgraphics"; 10 - repo = v.name; 11 - rev = v.version; 12 - sha256 = v.sha256; 13 - meta = with lib; { 14 - platforms = platforms.all; 15 - maintainers = [ maintainers.matthewbauer maintainers.shazow ]; 16 - license = licenses.free; 17 }; 18 - }; 19 - }) (fromJSON (readFile ./themes.json)))
··· 1 + { lib, fetchFromGitHub, ... }: 2 3 with builtins; 4 5 + listToAttrs (map 6 + (v: { 7 + inherit (v) name; 8 + value = fetchFromGitHub { 9 + name = "${v.name}-${v.version}"; 10 + owner = "DFgraphics"; 11 + repo = v.name; 12 + rev = v.version; 13 + sha256 = v.sha256; 14 + meta = with lib; { 15 + platforms = platforms.all; 16 + maintainers = [ maintainers.matthewbauer maintainers.shazow ]; 17 + license = licenses.free; 18 + }; 19 }; 20 + }) 21 + (fromJSON (readFile ./themes.json)))
+8 -4
pkgs/games/dwarf-fortress/twbt/default.nix
··· 1 - { stdenvNoCC, lib, fetchurl, unzip 2 , dfVersion 3 }: 4 ··· 49 }; 50 }; 51 52 - release = if hasAttr dfVersion twbt-releases 53 - then getAttr dfVersion twbt-releases 54 - else throw "[TWBT] Unsupported Dwarf Fortress version: ${dfVersion}"; 55 in 56 57 stdenvNoCC.mkDerivation rec {
··· 1 + { stdenvNoCC 2 + , lib 3 + , fetchurl 4 + , unzip 5 , dfVersion 6 }: 7 ··· 52 }; 53 }; 54 55 + release = 56 + if hasAttr dfVersion twbt-releases 57 + then getAttr dfVersion twbt-releases 58 + else throw "[TWBT] Unsupported Dwarf Fortress version: ${dfVersion}"; 59 in 60 61 stdenvNoCC.mkDerivation rec {
+33 -9
pkgs/games/dwarf-fortress/unfuck.nix
··· 1 - { stdenv, lib, fetchFromGitHub, cmake 2 - , libGL, libSM, SDL, SDL_image, SDL_ttf, glew, openalSoft 3 - , ncurses, glib, gtk2, libsndfile, zlib 4 - , dfVersion, pkg-config 5 }: 6 7 with lib; ··· 46 }; 47 }; 48 49 - release = if hasAttr dfVersion unfuck-releases 50 - then getAttr dfVersion unfuck-releases 51 - else throw "[unfuck] Unknown Dwarf Fortress version: ${dfVersion}"; 52 in 53 54 stdenv.mkDerivation { ··· 68 69 nativeBuildInputs = [ cmake pkg-config ]; 70 buildInputs = [ 71 - libSM SDL SDL_image SDL_ttf glew openalSoft 72 - ncurses gtk2 libsndfile zlib libGL 73 ]; 74 75 # Don't strip unused symbols; dfhack hooks into some of them.
··· 1 + { stdenv 2 + , lib 3 + , fetchFromGitHub 4 + , cmake 5 + , libGL 6 + , libSM 7 + , SDL 8 + , SDL_image 9 + , SDL_ttf 10 + , glew 11 + , openalSoft 12 + , ncurses 13 + , glib 14 + , gtk2 15 + , libsndfile 16 + , zlib 17 + , dfVersion 18 + , pkg-config 19 }: 20 21 with lib; ··· 60 }; 61 }; 62 63 + release = 64 + if hasAttr dfVersion unfuck-releases 65 + then getAttr dfVersion unfuck-releases 66 + else throw "[unfuck] Unknown Dwarf Fortress version: ${dfVersion}"; 67 in 68 69 stdenv.mkDerivation { ··· 83 84 nativeBuildInputs = [ cmake pkg-config ]; 85 buildInputs = [ 86 + libSM 87 + SDL 88 + SDL_image 89 + SDL_ttf 90 + glew 91 + openalSoft 92 + ncurses 93 + gtk2 94 + libsndfile 95 + zlib 96 + libGL 97 ]; 98 99 # Don't strip unused symbols; dfhack hooks into some of them.
+29 -13
pkgs/games/dwarf-fortress/wrapper/default.nix
··· 1 - { stdenv, lib, buildEnv, substituteAll, runCommand 2 , dwarf-fortress 3 , dwarf-therapist 4 - , enableDFHack ? false, dfhack 5 - , enableSoundSense ? false, soundSense, jdk 6 , enableStoneSense ? false 7 - , enableTWBT ? false, twbt 8 - , themes ? {} 9 , theme ? null 10 - # General config options: 11 , enableIntro ? true 12 , enableTruetype ? true 13 , enableFPS ? false ··· 31 # These are in inverse order for first packages to override the next ones. 32 themePkg = lib.optional (theme != null) ptheme; 33 pkgs = lib.optional enableDFHack dfhack_ 34 - ++ lib.optional enableSoundSense soundSense 35 - ++ lib.optional enableTWBT twbt.art 36 - ++ [ dwarf-fortress ]; 37 38 - fixup = lib.singleton (runCommand "fixup" {} ('' 39 mkdir -p $out/data/init 40 '' + (if (theme != null) then '' 41 cp ${lib.head themePkg}/data/init/init.txt $out/data/init/init.txt ··· 61 substituteInPlace $out/data/init/init.txt \ 62 --replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]' 63 '' + 64 - lib.optionalString enableTextMode '' 65 substituteInPlace $out/data/init/init.txt \ 66 --replace '[PRINT_MODE:2D]' '[PRINT_MODE:TEXT]' 67 '' + '' ··· 89 name = "dwarf-fortress-init"; 90 src = ./dwarf-fortress-init.in; 91 inherit env; 92 - exe = if stdenv.isLinux then "libs/Dwarf_Fortress" 93 - else "dwarfort.exe"; 94 }; 95 96 runDF = ./dwarf-fortress.in;
··· 1 + { stdenv 2 + , lib 3 + , buildEnv 4 + , substituteAll 5 + , runCommand 6 + , coreutils 7 , dwarf-fortress 8 , dwarf-therapist 9 + , enableDFHack ? false 10 + , dfhack 11 + , enableSoundSense ? false 12 + , soundSense 13 + , jdk 14 , enableStoneSense ? false 15 + , enableTWBT ? false 16 + , twbt 17 + , themes ? { } 18 , theme ? null 19 + # General config options: 20 , enableIntro ? true 21 , enableTruetype ? true 22 , enableFPS ? false ··· 40 # These are in inverse order for first packages to override the next ones. 41 themePkg = lib.optional (theme != null) ptheme; 42 pkgs = lib.optional enableDFHack dfhack_ 43 + ++ lib.optional enableSoundSense soundSense 44 + ++ lib.optional enableTWBT twbt.art 45 + ++ [ dwarf-fortress ]; 46 47 + fixup = lib.singleton (runCommand "fixup" { } ('' 48 mkdir -p $out/data/init 49 '' + (if (theme != null) then '' 50 cp ${lib.head themePkg}/data/init/init.txt $out/data/init/init.txt ··· 70 substituteInPlace $out/data/init/init.txt \ 71 --replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]' 72 '' + 73 + lib.optionalString enableTextMode '' 74 substituteInPlace $out/data/init/init.txt \ 75 --replace '[PRINT_MODE:2D]' '[PRINT_MODE:TEXT]' 76 '' + '' ··· 98 name = "dwarf-fortress-init"; 99 src = ./dwarf-fortress-init.in; 100 inherit env; 101 + exe = 102 + if stdenv.isLinux then "libs/Dwarf_Fortress" 103 + else "dwarfort.exe"; 104 + stdenv_shell = "${stdenv.shell}"; 105 + cp = "${coreutils}/bin/cp"; 106 + rm = "${coreutils}/bin/rm"; 107 + ln = "${coreutils}/bin/ln"; 108 + cat = "${coreutils}/bin/cat"; 109 + mkdir = "${coreutils}/bin/mkdir"; 110 }; 111 112 runDF = ./dwarf-fortress.in;
+9 -8
pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
··· 1 shopt -s extglob 2 3 [ -z "$DF_DIR" ] && export DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux" ··· 7 update_path() { 8 local path="$1" 9 10 - mkdir -p "$DF_DIR/$(dirname "$path")" 11 # If user has replaced these data directories, let them stay. 12 if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then 13 - rm -f "$DF_DIR/$path" 14 - ln -s "$env_dir/$path" "$DF_DIR/$path" 15 fi 16 } 17 18 forcecopy_path() { 19 local path="$1" 20 21 - mkdir -p "$DF_DIR/$(dirname "$path")" 22 - rm -rf "$DF_DIR/$path" 23 - cp -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path" 24 } 25 26 - mkdir -p "$DF_DIR" 27 28 - cat <<EOF >&2 29 Using $DF_DIR as Dwarf Fortress overlay directory. 30 If you do any changes in it, don't forget to clean it when updating the game version! 31 We try to detect changes based on data directories being symbolic links -- keep this in mind.
··· 1 + #!@stdenv_shell@ -e 2 shopt -s extglob 3 4 [ -z "$DF_DIR" ] && export DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux" ··· 8 update_path() { 9 local path="$1" 10 11 + @mkdir@ -p "$DF_DIR/$(dirname "$path")" 12 # If user has replaced these data directories, let them stay. 13 if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then 14 + @rm@ -f "$DF_DIR/$path" 15 + @ln@ -s "$env_dir/$path" "$DF_DIR/$path" 16 fi 17 } 18 19 forcecopy_path() { 20 local path="$1" 21 22 + @mkdir@ -p "$DF_DIR/$(dirname "$path")" 23 + @rm@ -rf "$DF_DIR/$path" 24 + @cp@ -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path" 25 } 26 27 + @mkdir@ -p "$DF_DIR" 28 29 + @cat@ <<EOF >&2 30 Using $DF_DIR as Dwarf Fortress overlay directory. 31 If you do any changes in it, don't forget to clean it when updating the game version! 32 We try to detect changes based on data directories being symbolic links -- keep this in mind.