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