uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
126
pkgs/games/dwarf-fortress/default.nix
Normal file
126
pkgs/games/dwarf-fortress/default.nix
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
{ stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs, libsForQt5, newScope, texlive, perlPackages, jdk8, jre8 }:
|
||||
|
||||
# To whomever it may concern:
|
||||
#
|
||||
# This directory menaces with spikes of Nix code. It is terrifying.
|
||||
#
|
||||
# If this is your first time here, you should probably install the dwarf-fortress-full package,
|
||||
# for instance with:
|
||||
#
|
||||
# environment.systemPackages = [ pkgs.dwarf-fortress-packages.dwarf-fortress-full ];
|
||||
#
|
||||
# You can adjust its settings by using override, or compile your own package by
|
||||
# using the other packages here.
|
||||
#
|
||||
# For example, you can enable the FPS indicator, disable the intro, pick a
|
||||
# theme other than phoebus (the default for dwarf-fortress-full), _and_ use
|
||||
# an older version with something like:
|
||||
#
|
||||
# environment.systemPackages = [
|
||||
# (pkgs.dwarf-fortress-packages.dwarf-fortress-full.override {
|
||||
# dfVersion = "0.44.11";
|
||||
# theme = "cla";
|
||||
# enableIntro = false;
|
||||
# enableFPS = true;
|
||||
# })
|
||||
# ]
|
||||
#
|
||||
# Take a look at lazy-pack.nix to see all the other options.
|
||||
#
|
||||
# You will find the configuration files in ~/.local/share/df_linux/data/init. If
|
||||
# you un-symlink them and edit, then the scripts will avoid overwriting your
|
||||
# changes on later launches, but consider extending the wrapper with your
|
||||
# desired options instead.
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
callPackage = newScope self;
|
||||
|
||||
# The latest Dwarf Fortress version. Maintainers: when a new version comes
|
||||
# out, ensure that (unfuck|dfhack|twbt) are all up to date before changing
|
||||
# this.
|
||||
latestVersion = "0.47.05";
|
||||
|
||||
# Converts a version to a package name.
|
||||
versionToName = version: "dwarf-fortress_${lib.replaceStrings ["."] ["_"] version}";
|
||||
|
||||
dwarf-therapist-original = libsForQt5.callPackage ./dwarf-therapist {
|
||||
texlive = texlive.combine {
|
||||
inherit (texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
|
||||
};
|
||||
};
|
||||
|
||||
# A map of names to each Dwarf Fortress package we know about.
|
||||
df-games = lib.listToAttrs (map
|
||||
(dfVersion: {
|
||||
name = versionToName dfVersion;
|
||||
value =
|
||||
let
|
||||
# I can't believe this syntax works. Spikes of Nix code indeed...
|
||||
dwarf-fortress = callPackage ./game.nix {
|
||||
inherit dfVersion;
|
||||
inherit dwarf-fortress-unfuck;
|
||||
};
|
||||
|
||||
# unfuck is linux-only right now, we will only use it there.
|
||||
dwarf-fortress-unfuck =
|
||||
if stdenv.isLinux then callPackage ./unfuck.nix { inherit dfVersion; }
|
||||
else null;
|
||||
|
||||
twbt = callPackage ./twbt { inherit dfVersion; };
|
||||
|
||||
dfhack = callPackage ./dfhack {
|
||||
inherit (perlPackages) XMLLibXML XMLLibXSLT;
|
||||
inherit dfVersion twbt;
|
||||
stdenv = gccStdenv;
|
||||
};
|
||||
|
||||
dwarf-therapist = libsForQt5.callPackage ./dwarf-therapist/wrapper.nix {
|
||||
inherit dwarf-fortress;
|
||||
dwarf-therapist = dwarf-therapist-original;
|
||||
};
|
||||
in
|
||||
callPackage ./wrapper {
|
||||
inherit (self) themes;
|
||||
|
||||
dwarf-fortress = dwarf-fortress;
|
||||
twbt = twbt;
|
||||
dfhack = dfhack;
|
||||
dwarf-therapist = dwarf-therapist;
|
||||
|
||||
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
||||
};
|
||||
})
|
||||
(lib.attrNames self.df-hashes));
|
||||
|
||||
self = rec {
|
||||
df-hashes = lib.importJSON ./game.json;
|
||||
|
||||
# Aliases for the latest Dwarf Fortress and the selected Therapist install
|
||||
dwarf-fortress = getAttr (versionToName latestVersion) df-games;
|
||||
inherit dwarf-therapist-original;
|
||||
dwarf-therapist = dwarf-fortress.dwarf-therapist;
|
||||
dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
|
||||
|
||||
dwarf-fortress-full = callPackage ./lazy-pack.nix {
|
||||
inherit df-games versionToName latestVersion;
|
||||
};
|
||||
|
||||
soundSense = callPackage ./soundsense.nix { };
|
||||
|
||||
legends-browser = callPackage ./legends-browser {
|
||||
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
||||
};
|
||||
|
||||
themes = recurseIntoAttrs (callPackage ./themes {
|
||||
stdenv = stdenvNoCC;
|
||||
});
|
||||
|
||||
# Theme aliases
|
||||
phoebus-theme = themes.phoebus;
|
||||
cla-theme = themes.cla;
|
||||
};
|
||||
|
||||
in
|
||||
self // df-games
|
||||
40
pkgs/games/dwarf-fortress/df_permission
Normal file
40
pkgs/games/dwarf-fortress/df_permission
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
From tarn.adams@gmail.com Sat Oct 30 00:56:16 2010
|
||||
Date: Fri, 29 Oct 2010 16:56:15 -0800
|
||||
From: Tarn Adams <tarn.adams@gmail.com>
|
||||
To: roconnor@theorem.ca
|
||||
Subject: Re: Dwarf Fortress Redistribution for NixOS
|
||||
|
||||
Sure, that redistribution is fine. I think I've handled the movie
|
||||
issue for next time now. Thanks for the heads up on that.
|
||||
|
||||
Tarn
|
||||
|
||||
On Fri, Oct 29, 2010 at 6:56 AM, <roconnor@theorem.ca> wrote:
|
||||
> I'd like to distribute a *slightly* modified version of Dwarf Fortress which
|
||||
> is needed to run it under the NixOS distribution of Linux (see
|
||||
> <https://nixos.org/>
|
||||
>
|
||||
> Modification: The interpreter location /lib/ld-linux.so.2 in
|
||||
> lib/Dwarf_Fortress is replaced with the location of ld-linux.so.2 under the
|
||||
> NixOS distribution (which is currently
|
||||
> /nix/store/l8x3fdy1r6zf441vnqa87lzsvxrjbdz9-glibc-2.11.1/lib/ld-linux.so.2
|
||||
> but might change at a later date to something similar).
|
||||
>
|
||||
> I don't need you to recompile Dwarf Fortress. I can patch the binary itself
|
||||
> using patchelf. I just would like your permission to redistrubute this
|
||||
> modified binary.
|
||||
>
|
||||
> Thanks, I'm looking forward to trying out your game and letting other Nix
|
||||
> users try it out too.
|
||||
>
|
||||
> P.S. the inital_movies are open in read/write mode instead of read-only mode
|
||||
> which causes some issues under NixOS because the inital_movies are stored
|
||||
> read-only. I have a workaround, but you may want to consider opening these
|
||||
> files in read-only mode.
|
||||
>
|
||||
> --
|
||||
> Russell O'Connor <http://r6.ca/>
|
||||
> ``All talk about `theft,''' the general counsel of the American Graphophone
|
||||
> Company wrote, ``is the merest claptrap, for there exists no property in
|
||||
> ideas musical, literary or artistic, except as defined by statute.''
|
||||
>
|
||||
190
pkgs/games/dwarf-fortress/dfhack/default.nix
Normal file
190
pkgs/games/dwarf-fortress/dfhack/default.nix
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
{ stdenv
|
||||
, buildEnv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, writeScriptBin
|
||||
, perl
|
||||
, XMLLibXML
|
||||
, XMLLibXSLT
|
||||
, zlib
|
||||
, ruby
|
||||
, enableStoneSense ? false
|
||||
, allegro5
|
||||
, libGLU
|
||||
, libGL
|
||||
, enableTWBT ? true
|
||||
, twbt
|
||||
, SDL
|
||||
, dfVersion
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
dfhack-releases = {
|
||||
"0.43.05" = {
|
||||
dfHackRelease = "0.43.05-r3.1";
|
||||
sha256 = "1ds366i0qcfbn62w9qv98lsqcrm38npzgvcr35hf6ihqa6nc6xrl";
|
||||
xmlRev = "860a9041a75305609643d465123a4b598140dd7f";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.05" = {
|
||||
dfHackRelease = "0.44.05-r2";
|
||||
sha256 = "1cwifdhi48a976xc472nf6q2k0ibwqffil5a4llcymcxdbgxdcc9";
|
||||
xmlRev = "2794f8a6d7405d4858bac486a0bb17b94740c142";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.09" = {
|
||||
dfHackRelease = "0.44.09-r1";
|
||||
sha256 = "1nkfaa43pisbyik5inj5q2hja2vza5lwidg5z02jyh136jm64hwk";
|
||||
xmlRev = "3c0bf63674d5430deadaf7befaec42f0ec1e8bc5";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.10" = {
|
||||
dfHackRelease = "0.44.10-r2";
|
||||
sha256 = "19bxsghxzw3bilhr8sm4axz7p7z8lrvbdsd1vdjf5zbg04rs866i";
|
||||
xmlRev = "321bd48b10c4c3f694cc801a7dee6be392c09b7b";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.11" = {
|
||||
dfHackRelease = "0.44.11-beta2.1";
|
||||
sha256 = "1jgwcqg9m1ybv3szgnklp6zfpiw5mswla464dlj2gfi5v82zqbv2";
|
||||
xmlRev = "f27ebae6aa8fb12c46217adec5a812cd49a905c8";
|
||||
prerelease = true;
|
||||
};
|
||||
"0.44.12" = {
|
||||
dfHackRelease = "0.44.12-r1";
|
||||
sha256 = "0j03lq6j6w378z6cvm7jspxc7hhrqm8jaszlq0mzfvap0k13fgyy";
|
||||
xmlRev = "23500e4e9bd1885365d0a2ef1746c321c1dd5094";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.47.02" = {
|
||||
dfHackRelease = "0.47.02-alpha0";
|
||||
sha256 = "19lgykgqm0si9vd9hx4zw8b5m9188gg8r1a6h25np2m2ziqwbjj9";
|
||||
xmlRev = "23500e4e9bd1885365d0a2ef1746c321c1dd509a";
|
||||
prerelease = true;
|
||||
};
|
||||
"0.47.04" = {
|
||||
dfHackRelease = "0.47.04-r2";
|
||||
sha256 = "18ppn1dqaxi6ahjzsvb9kw70rvca106a1hibhzc4rxmraypnqb89";
|
||||
xmlRev = "036b662a1bbc96b4911f3cbe74dfa1243b6459bc";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.47.05" = {
|
||||
dfHackRelease = "0.47.05-r1";
|
||||
sha256 = "sha256-B0iv7fpIcnaO8sx9wPqI7/WuyLK15p8UYlYIcF5F5bw=";
|
||||
xmlRev = "11c379ffd31255f2a1415d98106114a46245e1c3";
|
||||
prerelease = false;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
release =
|
||||
if hasAttr dfVersion dfhack-releases
|
||||
then getAttr dfVersion dfhack-releases
|
||||
else throw "[DFHack] Unsupported Dwarf Fortress version: ${dfVersion}";
|
||||
|
||||
version = release.dfHackRelease;
|
||||
|
||||
# revision of library/xml submodule
|
||||
xmlRev = release.xmlRev;
|
||||
|
||||
arch =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then "64"
|
||||
else if stdenv.hostPlatform.system == "i686-linux" then "32"
|
||||
else throw "Unsupported architecture";
|
||||
|
||||
fakegit = writeScriptBin "git" ''
|
||||
#! ${stdenv.shell}
|
||||
if [ "$*" = "describe --tags --long" ]; then
|
||||
echo "${version}-unknown"
|
||||
elif [ "$*" = "describe --tags --abbrev=8 --long" ]; then
|
||||
echo "${version}-unknown"
|
||||
elif [ "$*" = "describe --tags --abbrev=8 --exact-match" ]; then
|
||||
echo "${version}"
|
||||
elif [ "$*" = "rev-parse HEAD" ]; then
|
||||
if [ "$(dirname "$(pwd)")" = "xml" ]; then
|
||||
echo "${xmlRev}"
|
||||
else
|
||||
echo "refs/tags/${version}"
|
||||
fi
|
||||
elif [ "$*" = "rev-parse HEAD:library/xml" ]; then
|
||||
echo "${xmlRev}"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
dfhack = stdenv.mkDerivation {
|
||||
pname = "dfhack-base";
|
||||
inherit version;
|
||||
|
||||
# Beware of submodules
|
||||
src = fetchFromGitHub {
|
||||
owner = "DFHack";
|
||||
repo = "dfhack";
|
||||
rev = release.dfHackRelease;
|
||||
sha256 = release.sha256;
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
patches = [ ./fix-stonesense.patch ];
|
||||
|
||||
# gcc 11 fix
|
||||
NIX_CFLAGS_COMPILE = "-fpermissive";
|
||||
|
||||
# As of
|
||||
# https://github.com/DFHack/dfhack/commit/56e43a0dde023c5a4595a22b29d800153b31e3c4,
|
||||
# dfhack gets its goodies from the directory above the Dwarf_Fortress
|
||||
# executable, which leads to stock Dwarf Fortress and not the built
|
||||
# environment where all the dfhack resources are symlinked to (typically
|
||||
# ~/.local/share/df_linux). This causes errors like `tweak is not a
|
||||
# recognized command` to be reported and dfhack to lose some of its
|
||||
# functionality.
|
||||
postPatch = ''
|
||||
sed -i 's@cached_path = path_string.*@cached_path = getenv("DF_DIR");@' library/Process-linux.cpp
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
|
||||
# We don't use system libraries because dfhack needs old C++ ABI.
|
||||
buildInputs = [ zlib SDL ]
|
||||
++ lib.optionals enableStoneSense [ allegro5 libGLU libGL ];
|
||||
|
||||
preConfigure = ''
|
||||
# Trick build system into believing we have .git
|
||||
mkdir -p .git/modules/library/xml
|
||||
touch .git/index .git/modules/library/xml/index
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export LD_LIBRARY_PATH="$PWD/depends/protobuf''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
|
||||
'';
|
||||
|
||||
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ]
|
||||
++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ];
|
||||
|
||||
# dfhack expects an unversioned libruby.so to be present in the hack
|
||||
# subdirectory for ruby plugins to function.
|
||||
postInstall = ''
|
||||
ln -s ${ruby}/lib/libruby-*.so $out/hack/libruby.so
|
||||
'';
|
||||
|
||||
};
|
||||
in
|
||||
|
||||
buildEnv {
|
||||
name = "dfhack-${version}";
|
||||
|
||||
passthru = { inherit version dfVersion; };
|
||||
|
||||
paths = [ dfhack ] ++ lib.optionals enableTWBT [ twbt.lib ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
|
||||
homepage = "https://github.com/DFHack/dfhack/";
|
||||
license = licenses.zlib;
|
||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
maintainers = with maintainers; [ robbinch a1russell abbradar numinit ];
|
||||
};
|
||||
}
|
||||
23
pkgs/games/dwarf-fortress/dfhack/fix-stonesense.patch
Normal file
23
pkgs/games/dwarf-fortress/dfhack/fix-stonesense.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
From f5be6fe5fb192f01ae4551ed9217e97fd7f6a0ae Mon Sep 17 00:00:00 2001
|
||||
From: Herwig Hochleitner <hhochleitner@gmail.com>
|
||||
Date: Sun, 1 Oct 2017 18:01:43 +0200
|
||||
Subject: [PATCH] include <GL/glext.h>
|
||||
|
||||
this fixes `GLhandleARB` not being defined
|
||||
---
|
||||
plugins/stonesense/common.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/plugins/stonesense/common.h b/plugins/stonesense/common.h
|
||||
index eb36691..ef45389 100644
|
||||
--- a/plugins/stonesense/common.h
|
||||
+++ b/plugins/stonesense/common.h
|
||||
@@ -31,6 +31,8 @@ using namespace df::enums;
|
||||
#include <allegro5/allegro_opengl.h>
|
||||
#include <allegro5/utf8.h>
|
||||
|
||||
+#include <GL/glext.h>
|
||||
+
|
||||
// allegro leaks X headers, undef some of it here:
|
||||
#undef TileShape
|
||||
#undef None
|
||||
40
pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
Normal file
40
pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, qtbase
|
||||
, qtdeclarative
|
||||
, cmake
|
||||
, texlive
|
||||
, ninja
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "dwarf-therapist";
|
||||
version = "41.2.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Dwarf-Therapist";
|
||||
repo = "Dwarf-Therapist";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-zsEG68ioSw64UfmqlTLO1i5sObg8C4zxvdPxdQGMhhU=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ texlive cmake ninja ];
|
||||
buildInputs = [ qtbase qtdeclarative ];
|
||||
|
||||
installPhase =
|
||||
if stdenv.isDarwin then ''
|
||||
mkdir -p $out/Applications
|
||||
cp -r DwarfTherapist.app $out/Applications
|
||||
'' else null;
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Tool to manage dwarves in a running game of Dwarf Fortress";
|
||||
maintainers = with maintainers; [ abbradar bendlas numinit jonringer ];
|
||||
license = licenses.mit;
|
||||
platforms = platforms.unix;
|
||||
homepage = "https://github.com/Dwarf-Therapist/Dwarf-Therapist";
|
||||
};
|
||||
}
|
||||
25
pkgs/games/dwarf-fortress/dwarf-therapist/dwarf-therapist.in
Normal file
25
pkgs/games/dwarf-fortress/dwarf-therapist/dwarf-therapist.in
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!@stdenv_shell@ -e
|
||||
|
||||
[ -z "$DT_DIR" ] && DT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/dwarftherapist"
|
||||
|
||||
install_dir="@install@"
|
||||
therapist_dir="@therapist@"
|
||||
|
||||
@cat@ <<EOF >&2
|
||||
Using $DT_DIR as Dwarf Therapist overlay directory.
|
||||
EOF
|
||||
|
||||
update_path() {
|
||||
local path="$1"
|
||||
|
||||
@mkdir@ -p "$DT_DIR/$(@dirname@ "$path")"
|
||||
if [ ! -e "$DT_DIR/$path" ] || [ -L "$DT_DIR/$path" ]; then
|
||||
@rm@ -f "$DT_DIR/$path"
|
||||
@ln@ -s "$install_dir/share/dwarftherapist/$path" "$DT_DIR/$path"
|
||||
fi
|
||||
}
|
||||
|
||||
cd "$install_dir/share/dwarftherapist"
|
||||
update_path memory_layouts
|
||||
|
||||
exec "$therapist_dir/bin/dwarftherapist" "$@"
|
||||
60
pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
Normal file
60
pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{ stdenv, dwarf-therapist, dwarf-fortress, substituteAll, coreutils, wrapQtAppsHook }:
|
||||
|
||||
let
|
||||
platformSlug =
|
||||
if stdenv.targetPlatform.is32bit then
|
||||
"linux32" else "linux64";
|
||||
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "dwarf-therapist";
|
||||
version = dwarf-therapist.version;
|
||||
|
||||
wrapper = substituteAll {
|
||||
src = ./dwarf-therapist.in;
|
||||
stdenv_shell = "${stdenv.shell}";
|
||||
rm = "${coreutils}/bin/rm";
|
||||
ln = "${coreutils}/bin/ln";
|
||||
cat = "${coreutils}/bin/cat";
|
||||
mkdir = "${coreutils}/bin/mkdir";
|
||||
dirname = "${coreutils}/bin/dirname";
|
||||
therapist = "${dwarf-therapist}";
|
||||
};
|
||||
|
||||
paths = [ dwarf-therapist ];
|
||||
|
||||
nativeBuildInputs = [ wrapQtAppsHook ];
|
||||
|
||||
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
install -Dm755 $wrapper $out/bin/dwarftherapist
|
||||
ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
|
||||
|
||||
substituteInPlace $out/bin/dwarftherapist \
|
||||
--subst-var-by install $out
|
||||
wrapQtApp $out/bin/dwarftherapist
|
||||
|
||||
# Fix up memory layouts
|
||||
rm -rf $out/share/dwarftherapist/memory_layouts/linux
|
||||
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
|
||||
orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
|
||||
patched_md5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
|
||||
input_file="${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile}"
|
||||
output_file="$out/share/dwarftherapist/memory_layouts/${inifile}"
|
||||
|
||||
echo "[Dwarf Therapist Wrapper] Fixing Dwarf Fortress MD5 prefix:"
|
||||
echo " Input: $input_file"
|
||||
echo " Search: $orig_md5"
|
||||
echo " Output: $output_file"
|
||||
echo " Replace: $patched_md5"
|
||||
|
||||
substitute "$input_file" "$output_file" --replace "$orig_md5" "$patched_md5"
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
139
pkgs/games/dwarf-fortress/game.json
Normal file
139
pkgs/games/dwarf-fortress/game.json
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
{
|
||||
"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"
|
||||
},
|
||||
"0.47.01": {
|
||||
"linux": "1wbybkfpgvpd2yliy8mfgddnz806ac4rv4j0lhlsqwpk8jj0mx81",
|
||||
"linux32": "1fnz1mydqgybcm8kzranvjzc2x9g6bcalxv3fsjngvpv13x6izzv",
|
||||
"osx": "18wdffidasbrsbhqjwds08ckbrjhcw0759aynz7zggyy5is9q8iw",
|
||||
"osx32": "1b4kf3vg0zd5w5s0rdhzfz0rswkl6sq0j1f8qmimnw7qd09h43wx",
|
||||
"win": "1v3v2z7g67d6926h9lxakznvbddyxyr85i1ym34y2wywnc886z7r",
|
||||
"win_s": "0yahynimhz4nvdi5qp5a612vf7ikg87w2aj2r8s1lhdw6xwdkpyc",
|
||||
"win32": "07mqhm64c1ddjc3vpyhf9qf14lp19xwz3pgg4c2pvcwy4yyrys22",
|
||||
"win32_s": "07acbxai8g04yxg7n68nyx4jwcqqkgjn7n96q2lzxdvc988kiivz",
|
||||
"legacy32_s": "1gxmc3rsl9glai3wb4wzsda3qyhdimd8s5kbr5m753n8lmzasafx"
|
||||
},
|
||||
"0.47.02": {
|
||||
"linux": "1zbsygbfiqxxs767qxkxjp3ayywi5q0d8xlrqlbd0l8a3ccg5avw",
|
||||
"linux32": "1ddc9s4n408j8gidgign51bgv2wgy5z4cy74jzx00pvnhsfp2mpy",
|
||||
"osx": "1mwy88yxip1wys1kxpfsbg7wlvfrkc4lg04gqw0d266a88dj7a30",
|
||||
"osx32": "08ssnzl52gqqgcqhl0ynyikbxz76825kpcg1d6yx8g7ifjndf19n",
|
||||
"win": "08g7fy18y8q32l0158314bny0qg57xz37qj9fri9r4xbhci67ldk",
|
||||
"win_s": "0x56s1md62yk661aqcdgnz8k0zir0zr8qwan5vrqc0q9yh069yl1",
|
||||
"win32": "0ww64mymbilb235n93d7w4c9axq3ww2mxa0f7bl4x8yrxwc8k942",
|
||||
"win32_s": "0r801vip807v88icf47i3s82v7lshx67q4ilzfjirqfslh1x00bs",
|
||||
"legacy": "14f4d6r7swfjnlaalg4l5916ihj6wvhlsgjp7cygamzp4c2wgng8",
|
||||
"legacy_s": "1jxf52kaijf4crwxj30a4f6z7rzs6xa91y6vn5s8jr0cvbr5pz64",
|
||||
"legacy32": "0j7shqdv3gimacj03cil2y0fmr0j0fp57cwmdjwnxwx3m96k3xwm",
|
||||
"legacy32_s": "1wc7pcp9dwz0q1na3i5pbqknya595qdkmr7hsmgh2kk8rsp3g9g2"
|
||||
},
|
||||
"0.47.04": {
|
||||
"linux": "1ri82c5hja6n0wv538srf2nbcyb8ip49w4l201m90cmcycmqgr8x",
|
||||
"linux32": "00yz8gl75sbx15d7vl22ij0a5qd325kpc9mgm1lh5g7i065vgzn8",
|
||||
"osx": "0c1g655bn5n4pbzxw3v83gmy54va5y87m7ksi6iryfal0m9lshhv",
|
||||
"osx32": "1knfgqbwa7v9va1w6i8yzz6xp3dj633dbs50izx6ldszm0ra42pg",
|
||||
"win": "0j7ixr3rf9900zzfw3nd3vg97kdkspm530cmf9dkwhf6klmpks7s",
|
||||
"win_s": "11amw5gjhi753mvf17wifcjiyikjx0qwa16787gfhj9jfp0yw764",
|
||||
"win32": "1xw9f49n85c31kbzkm5zh81kccjx9msjyy3xwr0klak5w398a59l",
|
||||
"win32_s": "0s26hrgfk2b5wg4dvg90wgw1mvrrvbyjhmsys9f5fl7zn1pjbxxr",
|
||||
"legacy": "103bcnn8gxi2rkpjmjfgv5a5kxmh1zd7vagrsscv55sppd7fcl7n",
|
||||
"legacy_s": "19ai7lvxx0y3iha9qrbl5krric547rzs6vm4ibk8x61vv97jrbd8",
|
||||
"legacy32": "0lli6s1g7yj3p3h26ajgq3h619n88qn6s7amyz6z8w7hyzfi7wij",
|
||||
"legacy32_s": "1wzxbzgln9pmsk2nchrl94d2yd09xdgynmjl4qwcaqzkrnf3sfqc"
|
||||
},
|
||||
"0.47.05": {
|
||||
"linux": "18zwmz2nsgwjxbr2yd9jcrgw6l5b481hh1848cgn5nfpnzdscx5c",
|
||||
"linux32": "1jbav7ghsjsxd6cdp6f2x5qn83zc8707dqan5sp73fp6mbj2jasl",
|
||||
"osx": "092z1vhc5sbdc5irggdz5ai7rxifmg4yhy33aicpsjcnvcmajydw",
|
||||
"osx32": "0lpbwfiagp0zp280aw3fmj8938w5fc5r9gibzk2h86jy63ps29ww",
|
||||
"win": "0bbk7j3d4h2wn9hmbsbbbbr0ajf3ddlprxfaajfbnbiyv72cpn9s",
|
||||
"win_s": "0nl7c9dpfx7jjpy7y52z8h3kiy4cpax1m58apbcfyy95an4jz8s4",
|
||||
"win32": "08ka1lklly82h4mr770y9p0a21x9dx6jqvjgxdsxj5979f26il1v",
|
||||
"win32_s": "06w844zxzx3lfykibgkk4gbg4xymnqraj1ikv4mzlv31l727a1x4",
|
||||
"legacy": "042a0gbad3cp5dwhnrzg3vr9w48b8ybqgxgw5i9rk4c1i0gjjpw2",
|
||||
"legacy_s": "1rb7h8lzlsjs08rvhhl3nwbrpj54zijijp4y0qdp4vyzsig6nisk",
|
||||
"legacy32": "0ayw09x9smihh8qp5pdvr6vvhwkvcqz36h3lh4g1b5kzxj7g9cyf",
|
||||
"legacy32_s": "10gfxlysfs9gyi1mv52idp5xk45g9h517g2jq4a8cqp2j7594v9c"
|
||||
}
|
||||
}
|
||||
111
pkgs/games/dwarf-fortress/game.nix
Normal file
111
pkgs/games/dwarf-fortress/game.nix
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
, SDL
|
||||
, dwarf-fortress-unfuck
|
||||
|
||||
# Our own "unfuck" libs for macOS
|
||||
, ncurses
|
||||
, fmodex
|
||||
, gcc
|
||||
|
||||
, dfVersion
|
||||
, df-hashes
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
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.
|
||||
platforms = {
|
||||
x86_64-linux = "linux";
|
||||
i686-linux = "linux32";
|
||||
x86_64-darwin = "osx";
|
||||
i686-darwin = "osx32";
|
||||
x86_64-cygwin = "win";
|
||||
i686-cygwin = "win32";
|
||||
};
|
||||
|
||||
dfVersionTriple = splitVersion dfVersion;
|
||||
baseVersion = elemAt dfVersionTriple 1;
|
||||
patchVersion = elemAt dfVersionTriple 2;
|
||||
|
||||
game =
|
||||
if hasAttr dfVersion df-hashes
|
||||
then getAttr dfVersion df-hashes
|
||||
else throw "Unknown Dwarf Fortress version: ${dfVersion}";
|
||||
dfPlatform =
|
||||
if hasAttr stdenv.hostPlatform.system platforms
|
||||
then getAttr stdenv.hostPlatform.system platforms
|
||||
else throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
||||
sha256 =
|
||||
if hasAttr dfPlatform game
|
||||
then getAttr dfPlatform game
|
||||
else throw "Unsupported dfPlatform: ${dfPlatform}";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "dwarf-fortress";
|
||||
version = dfVersion;
|
||||
|
||||
src = fetchurl {
|
||||
url = "${homepage}df_${baseVersion}_${patchVersion}_${dfPlatform}.tar.bz2";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r * $out
|
||||
rm $out/libs/lib*
|
||||
|
||||
exe=$out/${if stdenv.isLinux then "libs/Dwarf_Fortress"
|
||||
else "dwarfort.exe"}
|
||||
|
||||
# Store the original hash
|
||||
md5sum $exe | awk '{ print $1 }' > $out/hash.md5.orig
|
||||
'' + optionalString stdenv.isLinux ''
|
||||
patchelf \
|
||||
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
|
||||
--set-rpath "${libpath}" \
|
||||
$exe
|
||||
'' + optionalString stdenv.isDarwin ''
|
||||
# My custom unfucked dwarfort.exe for macOS. Can't use
|
||||
# absolute paths because original doesn't have enough
|
||||
# header space. Someone plz break into Tarn's house & put
|
||||
# -headerpad_max_install_names into his LDFLAGS.
|
||||
|
||||
ln -s ${getLib ncurses}/lib/libncurses.dylib $out/libs
|
||||
ln -s ${getLib gcc.cc}/lib/libstdc++.6.dylib $out/libs
|
||||
ln -s ${getLib fmodex}/lib/libfmodex.dylib $out/libs
|
||||
|
||||
install_name_tool \
|
||||
-change /usr/lib/libncurses.5.4.dylib \
|
||||
@executable_path/libs/libncurses.dylib \
|
||||
-change /usr/local/lib/x86_64/libstdc++.6.dylib \
|
||||
@executable_path/libs/libstdc++.6.dylib \
|
||||
$exe
|
||||
'' + ''
|
||||
# Store the new hash
|
||||
md5sum $exe | awk '{ print $1 }' > $out/hash.md5
|
||||
'';
|
||||
|
||||
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 platforms;
|
||||
maintainers = with maintainers; [ a1russell robbinch roconnor abbradar numinit shazow ];
|
||||
};
|
||||
}
|
||||
56
pkgs/games/dwarf-fortress/lazy-pack.nix
Normal file
56
pkgs/games/dwarf-fortress/lazy-pack.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ stdenvNoCC
|
||||
, lib
|
||||
, buildEnv
|
||||
, df-games
|
||||
, themes
|
||||
, latestVersion
|
||||
, versionToName
|
||||
, dfVersion ? latestVersion
|
||||
# This package should, at any given time, provide an opinionated "optimal"
|
||||
# DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and
|
||||
# should contain every utility available unless you disable them.
|
||||
, enableDFHack ? stdenvNoCC.isLinux
|
||||
, enableTWBT ? enableDFHack
|
||||
, enableSoundSense ? true
|
||||
, enableStoneSense ? true
|
||||
, enableDwarfTherapist ? true
|
||||
, enableLegendsBrowser ? true
|
||||
, legends-browser
|
||||
, theme ? themes.phoebus
|
||||
# General config options:
|
||||
, enableIntro ? true
|
||||
, enableTruetype ? true
|
||||
, enableFPS ? false
|
||||
, enableTextMode ? false
|
||||
, enableSound ? true
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
dfGame = versionToName dfVersion;
|
||||
dwarf-fortress =
|
||||
if hasAttr dfGame df-games
|
||||
then getAttr dfGame df-games
|
||||
else throw "Unknown Dwarf Fortress version: ${dfVersion}";
|
||||
dwarf-therapist = dwarf-fortress.dwarf-therapist;
|
||||
in
|
||||
buildEnv {
|
||||
name = "dwarf-fortress-full";
|
||||
paths = [
|
||||
(dwarf-fortress.override {
|
||||
inherit enableDFHack enableTWBT enableSoundSense enableStoneSense theme
|
||||
enableIntro enableTruetype enableFPS enableTextMode enableSound;
|
||||
})
|
||||
]
|
||||
++ lib.optional enableDwarfTherapist dwarf-therapist
|
||||
++ lib.optional enableLegendsBrowser legends-browser;
|
||||
|
||||
meta = with lib; {
|
||||
description = "An opinionated wrapper for Dwarf Fortress";
|
||||
maintainers = with maintainers; [ Baughn numinit ];
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
homepage = "https://github.com/NixOS/nixpkgs/";
|
||||
};
|
||||
}
|
||||
37
pkgs/games/dwarf-fortress/legends-browser/default.nix
Normal file
37
pkgs/games/dwarf-fortress/legends-browser/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ lib, buildEnv, writeShellScriptBin, fetchurl, jre }:
|
||||
|
||||
let
|
||||
name = "legends-browser-${version}";
|
||||
version = "1.17.1";
|
||||
|
||||
jar = fetchurl {
|
||||
url = "https://github.com/robertjanetzko/LegendsBrowser/releases/download/${version}/legendsbrowser-${version}.jar";
|
||||
sha256 = "05b4ksbl4481rh3ykfirbp6wvxhppcd5mvclhn9995gsrcaj8gx9";
|
||||
};
|
||||
|
||||
script = writeShellScriptBin "legends-browser" ''
|
||||
set -eu
|
||||
BASE="$HOME/.local/share/df_linux/legends-browser/"
|
||||
mkdir -p "$BASE"
|
||||
cd "$BASE"
|
||||
if [[ ! -e legendsbrowser.properties ]]; then
|
||||
echo 'Creating initial configuration for legends-browser'
|
||||
echo "last=$(cd ..; pwd)" > legendsbrowser.properties
|
||||
fi
|
||||
${jre}/bin/java -jar ${jar}
|
||||
'';
|
||||
in
|
||||
|
||||
buildEnv {
|
||||
inherit name;
|
||||
paths = [ script ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A multi-platform, open source, java-based legends viewer for dwarf fortress";
|
||||
maintainers = with maintainers; [ Baughn ];
|
||||
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
homepage = "https://github.com/robertjanetzko/LegendsBrowser";
|
||||
};
|
||||
}
|
||||
37
pkgs/games/dwarf-fortress/soundsense.nix
Normal file
37
pkgs/games/dwarf-fortress/soundsense.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ stdenv
|
||||
, fetchzip
|
||||
, dos2unix
|
||||
, soundPack ? stdenv.mkDerivation {
|
||||
name = "soundsense-soundpack";
|
||||
src = fetchzip {
|
||||
url = "http://df.zweistein.cz/soundsense/soundpack.zip";
|
||||
sha256 = "0qz0mjkp7wp0gxk3ws2x760awv8c9lkacj2fn9bz3gqqnq262ffa";
|
||||
};
|
||||
installPhase = ''
|
||||
cp -r . $out
|
||||
'';
|
||||
}
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "2016-1_196";
|
||||
dfVersion = "0.44.12";
|
||||
inherit soundPack;
|
||||
pname = "soundsense";
|
||||
src = fetchzip {
|
||||
url = "http://df.zweistein.cz/soundsense/soundSense_${version}.zip";
|
||||
sha256 = "1gkrs69l3xsh858yjp204ddp29m668j630akm7arssc9359wxqkk";
|
||||
};
|
||||
nativeBuildInputs = [ dos2unix ];
|
||||
buildPhase = ''
|
||||
dos2unix soundSense.sh
|
||||
chmod +x soundSense.sh
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -R . $out/soundsense
|
||||
ln -s $out/soundsense/dfhack $out/hack
|
||||
ln -s $soundPack $out/soundsense/packs
|
||||
'';
|
||||
passthru = { inherit version dfVersion; };
|
||||
}
|
||||
21
pkgs/games/dwarf-fortress/themes/default.nix
Normal file
21
pkgs/games/dwarf-fortress/themes/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ lib, fetchFromGitHub, ... }:
|
||||
|
||||
with builtins;
|
||||
|
||||
listToAttrs (map
|
||||
(v: {
|
||||
inherit (v) name;
|
||||
value = fetchFromGitHub {
|
||||
name = "${v.name}-theme-${v.version}";
|
||||
owner = "DFgraphics";
|
||||
repo = v.name;
|
||||
rev = v.version;
|
||||
sha256 = v.sha256;
|
||||
meta = with lib; {
|
||||
platforms = platforms.all;
|
||||
maintainers = [ maintainers.matthewbauer maintainers.shazow ];
|
||||
license = licenses.free;
|
||||
};
|
||||
};
|
||||
})
|
||||
(fromJSON (readFile ./themes.json)))
|
||||
87
pkgs/games/dwarf-fortress/themes/themes.json
Normal file
87
pkgs/games/dwarf-fortress/themes/themes.json
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
[
|
||||
{
|
||||
"name": "afro-graphics",
|
||||
"version": "47.05",
|
||||
"sha256": "0gqrxb4bbx1h93xjz4ygd7yp8g5barj2zc6y7xvr94ww8b9a2r28"
|
||||
},
|
||||
{
|
||||
"name": "autoreiv",
|
||||
"version": "47.01",
|
||||
"sha256": "1c2xchlfq7ajpcq8qgrzkw5yfgm0k3fiwq6n7l4724dlbim3rjp2"
|
||||
},
|
||||
{
|
||||
"name": "cla",
|
||||
"version": "0.47.xx-v26.3",
|
||||
"sha256": "0ca81r3821jja4pqib75qxcsgg3s0wxzyq1jb4jc0495cvzxw7qa"
|
||||
},
|
||||
{
|
||||
"name": "dfgraphics",
|
||||
"version": "42.05",
|
||||
"sha256": "18xyqn458hh8l2qgbvrvz17nbp6yk91d7rqlxlp1g5wr9qfq28rp"
|
||||
},
|
||||
{
|
||||
"name": "gemset",
|
||||
"version": "47.05",
|
||||
"sha256": "1ivsbj71w3zwxnaz0405xhqhn4yzdfziijc0s0vmbmcphhhqnjaj"
|
||||
},
|
||||
{
|
||||
"name": "ironhand",
|
||||
"version": "47.05",
|
||||
"sha256": "003yrwishkzf6nvr6xlldbnd3x7rf5ds7l91mc0npdq1lcl0br9w"
|
||||
},
|
||||
{
|
||||
"name": "jolly-bastion",
|
||||
"version": "47.04",
|
||||
"sha256": "0799ad90g62nvpdcl6zq3vr2nvfc62lprm4br9n2hbs8wgrra6rq"
|
||||
},
|
||||
{
|
||||
"name": "mayday",
|
||||
"version": "47.05",
|
||||
"sha256": "17sdvr9a98xx5r2nrr3m4jlddvlb4h6qlch8r23g9g4mj0hsifnj"
|
||||
},
|
||||
{
|
||||
"name": "meph",
|
||||
"version": "47.05_v5.5.1-V",
|
||||
"sha256": "1kiqxiqw686dii5x7zav2nsw15csg0grv4h8hrb764rl4fw6x9nl"
|
||||
},
|
||||
{
|
||||
"name": "obsidian",
|
||||
"version": "47.05",
|
||||
"sha256": "1dkwdwm52fsj4gqqqr5vppbsk8a4kd3i7d3qawawgl0qn6q139xs"
|
||||
},
|
||||
{
|
||||
"name": "phoebus",
|
||||
"version": "47.05",
|
||||
"sha256": "18pn3dqyk9hp82gva92c6y3vk52s366rrx74rdnvahswdr5dmq4d"
|
||||
},
|
||||
{
|
||||
"name": "rally-ho",
|
||||
"version": "47.05",
|
||||
"sha256": "1h3jqq0yq2rbzbl70sq85lgdpwswczpay16kqfwq1n8zdisl4gqn"
|
||||
},
|
||||
{
|
||||
"name": "spacefox",
|
||||
"version": "47.05a",
|
||||
"sha256": "1y1rbsxr1m0mb2k02q6gh24c4nyqc9lw98dvfckp2bzc5f9cx3ks"
|
||||
},
|
||||
{
|
||||
"name": "taffer",
|
||||
"version": "47.04",
|
||||
"sha256": "1ly2sc0pb2kybb8grj19zx372whblmd0bj8p64akpi2rrywi13sy"
|
||||
},
|
||||
{
|
||||
"name": "tergel",
|
||||
"version": "47.01",
|
||||
"sha256": "142sd1i11vvirn68rp4gqzl67ww597df1lc57ycnpnz0n3q39kxy"
|
||||
},
|
||||
{
|
||||
"name": "vettlingr",
|
||||
"version": "47.05",
|
||||
"sha256": "0s1vy3ssp1hk8f6wlkz09xy5v747dpbsgw5vi6i1mq3lnlcy68vq"
|
||||
},
|
||||
{
|
||||
"name": "wanderlust",
|
||||
"version": "47.04",
|
||||
"sha256": "1z56m8zplq5d18sbkwg5lwcy8iwfa5hbxixsm3hdxm04qyld1z89"
|
||||
}
|
||||
]
|
||||
8
pkgs/games/dwarf-fortress/themes/update.sh
Executable file
8
pkgs/games/dwarf-fortress/themes/update.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p jq nix coreutils curl nix-prefetch-git
|
||||
|
||||
curl "https://api.github.com/users/dfgraphics/repos" | jq -r '.[].name | ascii_downcase' | while read repo; do
|
||||
version="$(curl "https://api.github.com/repos/DFgraphics/${repo}/releases/latest" | jq -r .tag_name)"
|
||||
sha256="$(nix-prefetch-git "https://github.com/DFgraphics/${repo}" "${version}" | jq -r ".sha256")"
|
||||
echo "{}" | jq ".name=\"${repo}\" | .version=\"${version}\" | .sha256=\"${sha256}\""
|
||||
done | jq -s . > themes.json
|
||||
100
pkgs/games/dwarf-fortress/twbt/default.nix
Normal file
100
pkgs/games/dwarf-fortress/twbt/default.nix
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
{ stdenvNoCC
|
||||
, lib
|
||||
, fetchurl
|
||||
, unzip
|
||||
, dfVersion
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
twbt-releases = {
|
||||
"0.43.05" = {
|
||||
twbtRelease = "6.22";
|
||||
sha256 = "0di5d38f6jj9smsz0wjcs1zav4zba6hrk8cbn59kwpb1wamsh5c7";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.05" = {
|
||||
twbtRelease = "6.35";
|
||||
sha256 = "0qjkgl7dsqzsd7pdq8a5bihhi1wplfkv1id7sj6dp3swjpsfxp8g";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.09" = {
|
||||
twbtRelease = "6.41";
|
||||
sha256 = "0nsq15z05pbhqjvw2xqs1a9b1n2ma0aalhc3vh3mi4cd4k7lxh44";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.10" = {
|
||||
twbtRelease = "6.49";
|
||||
sha256 = "1qjkc7k33qhxj2g18njzasccjqsis5y8zrw5vl90h4rs3i8ld9xz";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.44.11" = {
|
||||
twbtRelease = "6.51";
|
||||
sha256 = "1yclqmarjd97ch054h425a12r8a5ailmflsd7b39cg4qhdr1nii5";
|
||||
prerelease = true;
|
||||
};
|
||||
"0.44.12" = {
|
||||
twbtRelease = "6.54";
|
||||
sha256 = "10gfd6vv0vk4v1r5hjbz7vf1zqys06dsad695gysc7fbcik2dakh";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.47.02" = {
|
||||
twbtRelease = "6.61";
|
||||
sha256 = "07bqy9rkd64h033sxdpigp5zq4xrr0xd36wdr1b21g649mv8j6yw";
|
||||
prerelease = false;
|
||||
};
|
||||
"0.47.04" = {
|
||||
twbtRelease = "6.xx";
|
||||
dfhackRelease = "0.47.04-r2";
|
||||
sha256 = "092dgp8fh1j4nqr9wbzn89ib1nhscclr8m91lfxsvg0mgn7j8xlv";
|
||||
prerelease = true;
|
||||
};
|
||||
"0.47.05" = {
|
||||
twbtRelease = "6.xx";
|
||||
dfhackRelease = "0.47.05-r1";
|
||||
sha256 = "1nqhaf7271bm9rq9dmilhhk9q7v3841d0rv4y3fid40vfi4gpi3p";
|
||||
prerelease = true;
|
||||
};
|
||||
};
|
||||
|
||||
release =
|
||||
if hasAttr dfVersion twbt-releases
|
||||
then getAttr dfVersion twbt-releases
|
||||
else throw "[TWBT] Unsupported Dwarf Fortress version: ${dfVersion}";
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "twbt";
|
||||
version = release.twbtRelease;
|
||||
|
||||
src = fetchurl {
|
||||
url =
|
||||
if version == "6.xx" then
|
||||
"https://github.com/thurin/df-twbt/releases/download/${release.dfhackRelease}/twbt-${version}-linux64-${release.dfhackRelease}.zip"
|
||||
else
|
||||
"https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
|
||||
sha256 = release.sha256;
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
outputs = [ "lib" "art" "out" ];
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $lib/hack/{plugins,lua} $art/data/art
|
||||
cp -a */twbt.plug.so $lib/hack/plugins/
|
||||
cp -a *.lua $lib/hack/lua/
|
||||
cp -a *.png $art/data/art/
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A plugin for Dwarf Fortress / DFHack that improves various aspects the game interface.";
|
||||
maintainers = with maintainers; [ Baughn numinit ];
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux;
|
||||
homepage = "https://github.com/mifki/df-twbt";
|
||||
};
|
||||
}
|
||||
129
pkgs/games/dwarf-fortress/unfuck.nix
Normal file
129
pkgs/games/dwarf-fortress/unfuck.nix
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, libGL
|
||||
, libSM
|
||||
, SDL
|
||||
, SDL_image
|
||||
, SDL_ttf
|
||||
, glew
|
||||
, openalSoft
|
||||
, ncurses
|
||||
, glib
|
||||
, gtk2
|
||||
, gtk3
|
||||
, libsndfile
|
||||
, zlib
|
||||
, dfVersion
|
||||
, pkg-config
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
unfuck-releases = {
|
||||
"0.43.05" = {
|
||||
unfuckRelease = "0.43.05";
|
||||
sha256 = "173dyrbxlzqvjf1j3n7vpns4gfjkpyvk9z16430xnmd5m6nda8p2";
|
||||
};
|
||||
"0.44.05" = {
|
||||
unfuckRelease = "0.44.05";
|
||||
sha256 = "00yj4l4gazxg4i6fj9rwri6vm17i6bviy2mpkx0z5c0mvsr7s14b";
|
||||
};
|
||||
"0.44.09" = {
|
||||
unfuckRelease = "0.44.09";
|
||||
sha256 = "138p0v8z2x47f0fk9k6g75ikw5wb3vxldwv5ggbkf4hhvlw6lvzm";
|
||||
};
|
||||
"0.44.10" = {
|
||||
unfuckRelease = "0.44.10";
|
||||
sha256 = "0vb19qx2ibc79j4bgbk9lskb883qfb0815zw1dfz9k7rqwal8mzj";
|
||||
};
|
||||
"0.44.11" = {
|
||||
unfuckRelease = "0.44.11.1";
|
||||
sha256 = "1kszkb1d1vll8p04ja41nangsaxb5lv4p3xh2jhmsmipfixw7nvz";
|
||||
};
|
||||
"0.44.12" = {
|
||||
unfuckRelease = "0.44.12";
|
||||
sha256 = "1kszkb1d1vll8p04ja41nangsaxb5lv4p3xh2jhmsmipfixw7nvz";
|
||||
};
|
||||
"0.47.01" = {
|
||||
unfuckRelease = "0.47.01";
|
||||
sha256 = "11xvb3qh4crdf59pwfwpi73rzm3ysd1r1xp2k1jp7527jmqapk4k";
|
||||
};
|
||||
"0.47.02" = {
|
||||
unfuckRelease = "0.47.01";
|
||||
sha256 = "11xvb3qh4crdf59pwfwpi73rzm3ysd1r1xp2k1jp7527jmqapk4k";
|
||||
};
|
||||
"0.47.04" = {
|
||||
unfuckRelease = "0.47.04";
|
||||
sha256 = "1wa990xbsyiiz7abq153xmafvvk1dmgz33rp907d005kzl1z86i9";
|
||||
};
|
||||
"0.47.05" = {
|
||||
unfuckRelease = "0.47.04";
|
||||
sha256 = "1wa990xbsyiiz7abq153xmafvvk1dmgz33rp907d005kzl1z86i9";
|
||||
};
|
||||
};
|
||||
|
||||
release =
|
||||
if hasAttr dfVersion unfuck-releases
|
||||
then getAttr dfVersion unfuck-releases
|
||||
else throw "[unfuck] Unknown Dwarf Fortress version: ${dfVersion}";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "dwarf_fortress_unfuck";
|
||||
version = release.unfuckRelease;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "svenstaro";
|
||||
repo = "dwarf_fortress_unfuck";
|
||||
rev = release.unfuckRelease;
|
||||
sha256 = release.sha256;
|
||||
};
|
||||
|
||||
cmakeFlags = [
|
||||
"-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
|
||||
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
buildInputs = [
|
||||
libSM
|
||||
SDL
|
||||
SDL_image
|
||||
SDL_ttf
|
||||
glew
|
||||
openalSoft
|
||||
ncurses
|
||||
libsndfile
|
||||
zlib
|
||||
libGL
|
||||
]
|
||||
# switched to gtk3 in 0.47.05
|
||||
++ (if lib.versionOlder release.unfuckRelease "0.47.05" then [
|
||||
gtk2
|
||||
] else [
|
||||
gtk3
|
||||
]);
|
||||
|
||||
# Don't strip unused symbols; dfhack hooks into some of them.
|
||||
dontStrip = true;
|
||||
|
||||
installPhase = ''
|
||||
install -D -m755 ../build/libgraphics.so $out/lib/libgraphics.so
|
||||
'';
|
||||
|
||||
# Breaks dfhack because of inlining.
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
passthru = { inherit dfVersion; };
|
||||
|
||||
meta = with lib; {
|
||||
description = "Unfucked multimedia layer for Dwarf Fortress";
|
||||
homepage = "https://github.com/svenstaro/dwarf_fortress_unfuck";
|
||||
license = licenses.free;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ abbradar numinit ];
|
||||
};
|
||||
}
|
||||
42
pkgs/games/dwarf-fortress/update.sh
Executable file
42
pkgs/games/dwarf-fortress/update.sh
Executable file
|
|
@ -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 'DWARF FORTRESS CLASSIC ' \
|
||||
| sed 's/.*DWARF FORTRESS CLASSIC \([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"
|
||||
140
pkgs/games/dwarf-fortress/wrapper/default.nix
Normal file
140
pkgs/games/dwarf-fortress/wrapper/default.nix
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, buildEnv
|
||||
, substituteAll
|
||||
, runCommand
|
||||
, coreutils
|
||||
, dwarf-fortress
|
||||
, dwarf-therapist
|
||||
, enableDFHack ? false
|
||||
, dfhack
|
||||
, enableSoundSense ? false
|
||||
, soundSense
|
||||
, jdk
|
||||
, enableStoneSense ? false
|
||||
, enableTWBT ? false
|
||||
, twbt
|
||||
, themes ? { }
|
||||
, theme ? null
|
||||
# General config options:
|
||||
, enableIntro ? true
|
||||
, enableTruetype ? true
|
||||
, enableFPS ? false
|
||||
, enableTextMode ? false
|
||||
, enableSound ? true
|
||||
}:
|
||||
|
||||
let
|
||||
dfhack_ = dfhack.override {
|
||||
inherit enableStoneSense;
|
||||
inherit enableTWBT;
|
||||
};
|
||||
|
||||
ptheme =
|
||||
if builtins.isString theme
|
||||
then builtins.getAttr theme themes
|
||||
else theme;
|
||||
|
||||
unBool = b: if b then "YES" else "NO";
|
||||
|
||||
# These are in inverse order for first packages to override the next ones.
|
||||
themePkg = lib.optional (theme != null) ptheme;
|
||||
pkgs = lib.optional enableDFHack dfhack_
|
||||
++ lib.optional enableSoundSense soundSense
|
||||
++ lib.optional enableTWBT twbt.art
|
||||
++ [ dwarf-fortress ];
|
||||
|
||||
fixup = lib.singleton (runCommand "fixup" { } (''
|
||||
mkdir -p $out/data/init
|
||||
'' + (if (theme != null) then ''
|
||||
cp ${lib.head themePkg}/data/init/init.txt $out/data/init/init.txt
|
||||
'' else ''
|
||||
cp ${dwarf-fortress}/data/init/init.txt $out/data/init/init.txt
|
||||
'') + lib.optionalString enableDFHack ''
|
||||
mkdir -p $out/hack
|
||||
|
||||
# Patch the MD5
|
||||
orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig")
|
||||
patched_md5=$(cat "${dwarf-fortress}/hash.md5")
|
||||
input_file="${dfhack_}/hack/symbols.xml"
|
||||
output_file="$out/hack/symbols.xml"
|
||||
|
||||
echo "[DFHack Wrapper] Fixing Dwarf Fortress MD5:"
|
||||
echo " Input: $input_file"
|
||||
echo " Search: $orig_md5"
|
||||
echo " Output: $output_file"
|
||||
echo " Replace: $patched_md5"
|
||||
|
||||
substitute "$input_file" "$output_file" --replace "$orig_md5" "$patched_md5"
|
||||
'' + lib.optionalString enableTWBT ''
|
||||
substituteInPlace $out/data/init/init.txt \
|
||||
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
|
||||
'' +
|
||||
lib.optionalString enableTextMode ''
|
||||
substituteInPlace $out/data/init/init.txt \
|
||||
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TEXT]'
|
||||
'' + ''
|
||||
substituteInPlace $out/data/init/init.txt \
|
||||
--replace '[INTRO:YES]' '[INTRO:${unBool enableIntro}]' \
|
||||
--replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
|
||||
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]' \
|
||||
--replace '[SOUND:YES]' '[SOUND:${unBool enableSound}]'
|
||||
''));
|
||||
|
||||
env = buildEnv {
|
||||
name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}";
|
||||
|
||||
paths = fixup ++ themePkg ++ pkgs;
|
||||
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
||||
|
||||
ignoreCollisions = true;
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "dwarf-fortress";
|
||||
version = dwarf-fortress.dfVersion;
|
||||
|
||||
dfInit = substituteAll {
|
||||
name = "dwarf-fortress-init";
|
||||
src = ./dwarf-fortress-init.in;
|
||||
inherit env;
|
||||
exe =
|
||||
if stdenv.isLinux then "libs/Dwarf_Fortress"
|
||||
else "dwarfort.exe";
|
||||
stdenv_shell = "${stdenv.shell}";
|
||||
cp = "${coreutils}/bin/cp";
|
||||
rm = "${coreutils}/bin/rm";
|
||||
ln = "${coreutils}/bin/ln";
|
||||
cat = "${coreutils}/bin/cat";
|
||||
mkdir = "${coreutils}/bin/mkdir";
|
||||
};
|
||||
|
||||
runDF = ./dwarf-fortress.in;
|
||||
runDFHack = ./dfhack.in;
|
||||
runSoundSense = ./soundSense.in;
|
||||
|
||||
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
substitute $runDF $out/bin/dwarf-fortress \
|
||||
--subst-var-by stdenv_shell ${stdenv.shell} \
|
||||
--subst-var dfInit
|
||||
chmod 755 $out/bin/dwarf-fortress
|
||||
'' + lib.optionalString enableDFHack ''
|
||||
substitute $runDFHack $out/bin/dfhack \
|
||||
--subst-var-by stdenv_shell ${stdenv.shell} \
|
||||
--subst-var dfInit
|
||||
chmod 755 $out/bin/dfhack
|
||||
'' + lib.optionalString enableSoundSense ''
|
||||
substitute $runSoundSense $out/bin/soundsense \
|
||||
--subst-var-by stdenv_shell ${stdenv.shell} \
|
||||
--subst-var-by jre ${jdk.jre} \
|
||||
--subst-var dfInit
|
||||
chmod 755 $out/bin/soundsense
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
11
pkgs/games/dwarf-fortress/wrapper/dfhack.in
Normal file
11
pkgs/games/dwarf-fortress/wrapper/dfhack.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!@stdenv_shell@ -e
|
||||
|
||||
source @dfInit@
|
||||
|
||||
for i in dfhack.init-example dfhack-config/default hack/* stonesense/*; do
|
||||
update_path "$i"
|
||||
done
|
||||
|
||||
cd "$DF_DIR"
|
||||
LD_LIBRARY_PATH="$env_dir/hack/libs:$env_dir/hack${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \
|
||||
LD_PRELOAD="$env_dir/hack/libdfhack.so:$LD_PRELOAD" exec $env_dir/libs/Dwarf_Fortress "$@"
|
||||
45
pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
Normal file
45
pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#!@stdenv_shell@ -e
|
||||
shopt -s extglob
|
||||
|
||||
[ -z "$DF_DIR" ] && export DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux"
|
||||
env_dir="@env@"
|
||||
exe="$env_dir/@exe@"
|
||||
|
||||
update_path() {
|
||||
local path="$1"
|
||||
|
||||
@mkdir@ -p "$DF_DIR/$(dirname "$path")"
|
||||
# If user has replaced these data directories, let them stay.
|
||||
if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then
|
||||
@rm@ -f "$DF_DIR/$path"
|
||||
@ln@ -s "$env_dir/$path" "$DF_DIR/$path"
|
||||
fi
|
||||
}
|
||||
|
||||
forcecopy_path() {
|
||||
local path="$1"
|
||||
|
||||
@mkdir@ -p "$DF_DIR/$(dirname "$path")"
|
||||
@rm@ -rf "$DF_DIR/$path"
|
||||
@cp@ -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path"
|
||||
}
|
||||
|
||||
@mkdir@ -p "$DF_DIR"
|
||||
|
||||
@cat@ <<EOF >&2
|
||||
Using $DF_DIR as Dwarf Fortress overlay directory.
|
||||
If you do any changes in it, don't forget to clean it when updating the game version!
|
||||
We try to detect changes based on data directories being symbolic links -- keep this in mind.
|
||||
|
||||
EOF
|
||||
|
||||
cd "$env_dir"
|
||||
for i in data/init/* data/!(init|index|announcement) raw; do
|
||||
update_path "$i"
|
||||
done
|
||||
|
||||
forcecopy_path data/index
|
||||
# For some reason, it's needed to be writable...
|
||||
forcecopy_path data/announcement
|
||||
forcecopy_path data/help
|
||||
forcecopy_path data/dipscript
|
||||
9
pkgs/games/dwarf-fortress/wrapper/dwarf-fortress.in
Normal file
9
pkgs/games/dwarf-fortress/wrapper/dwarf-fortress.in
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!@stdenv_shell@ -e
|
||||
|
||||
source @dfInit@
|
||||
|
||||
export DYLD_LIBRARY_PATH="$env_dir/libs"
|
||||
export DYLD_FRAMEWORK_PATH="$env_dir/libs"
|
||||
|
||||
cd "$DF_DIR"
|
||||
exec "$exe" "$@"
|
||||
10
pkgs/games/dwarf-fortress/wrapper/soundSense.in
Normal file
10
pkgs/games/dwarf-fortress/wrapper/soundSense.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!@stdenv_shell@ -e
|
||||
|
||||
source @dfInit@
|
||||
|
||||
for p in soundsense/*; do
|
||||
update_path "$p"
|
||||
done
|
||||
|
||||
cd "$DF_DIR"
|
||||
PATH=@jre@/bin exec $DF_DIR/soundsense/soundSense.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue