···120120 name = "rename-lerp.patch";
121121 url = "https://github.com/DFHack/dfhack/commit/389dcf5cfcdb8bfb8deeb05fa5756c9f4f5709d1.patch";
122122 hash = "sha256-QuDtGURhP+nM+x+8GIKO5LrMcmBkl9JSHHIeqzqGIPQ=";
123123- });
123123+ })
124124+ # Newer versions use SDL_GetBasePath and SDL_GetPrefPath with a Windows-esque directory
125125+ # that mismatches where we have historically stored data in nixpkgs:
126126+ # https://github.com/libsdl-org/SDL/blob/release-2.24.x/src/filesystem/unix/SDL_sysfilesystem.c#L136
127127+ # Use SDL_GetPrefPath since this takes XDG_DATA_HOME into account (which is correct).
128128+ ++ optional (versionAtLeast version "52.02-r2") ./use-df-linux-dir.patch;
124129125130 # gcc 11 fix
126131 CXXFLAGS = optionalString (versionOlder version "0.47.05-r3") "-fpermissive";
127127-128128- # As of
129129- # https://github.com/DFHack/dfhack/commit/56e43a0dde023c5a4595a22b29d800153b31e3c4,
130130- # dfhack gets its goodies from the directory above the Dwarf_Fortress
131131- # executable, which leads to stock Dwarf Fortress and not the built
132132- # environment where all the dfhack resources are symlinked to (typically
133133- # ~/.local/share/df_linux). This causes errors like `tweak is not a
134134- # recognized command` to be reported and dfhack to lose some of its
135135- # functionality.
136136- postPatch = ''
137137- sed -i 's@cached_path = path_string.*@cached_path = getenv("DF_DIR");@' library/Process-linux.cpp
138138- '';
139132140133 nativeBuildInputs = [
141134 cmake
···7474 local orig_md5="$2"
7575 local patched_md5="$3"
7676 echo "It doesn't support DF $dfVersion out of the box, so we're doing it the hard way."
7777- export NIXPKGS_DF_HOME="$(mktemp -dt dfhack.XXXXXX)"
7777+ export HOME="$(mktemp -dt dfhack.XXXXXX)"
7878+ export XDG_DATA_HOME="$HOME/.local/share"
7879 expect ${dfHackExpectScript}
7979- local ini="$NIXPKGS_DF_HOME/therapist.ini"
8080+ local ini="$XDG_DATA_HOME/df_linux/therapist.ini"
8081 if [ -f "$ini" ]; then
8182 if grep -q "$patched_md5" "$ini"; then
8283 cp -v "$ini" "$output"
+1-1
pkgs/games/dwarf-fortress/update.rb
···571571572572 # Returns an array containing all versions.
573573 def all_versions
574574- self.game.versions.keys.map {"DF #{_1}"}.to_a + ["DT #{self.therapist.version}"]
574574+ [self.game.versions.keys.lazy.map {"DF #{_1}"}.first] + ["DT #{self.therapist.version}"]
575575 end
576576577577 # Loads this DFLock.