Merge pull request #43470 from numinit/df
dwarf-fortress: Refactor, round 2: let the user pick which version of the lazy pack to install
This commit is contained in:
commit
e4db8a903a
@ -5,67 +5,112 @@
|
|||||||
# This directory menaces with spikes of Nix code. It is terrifying.
|
# 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,
|
# If this is your first time here, you should probably install the dwarf-fortress-full package,
|
||||||
# for instance with `environment.systempackages = [ pkgs.dwarf-fortress.dwarf-fortress-full ];`.
|
# 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
|
# You can adjust its settings by using override, or compile your own package by
|
||||||
# using the other packages here. Take a look at lazy-pack.nix to get an idea of
|
# using the other packages here.
|
||||||
# how.
|
#
|
||||||
|
# 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 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
|
# you un-symlink them and edit, then the scripts will avoid overwriting your
|
||||||
# changes on later launches, but consider extending the wrapper with your
|
# changes on later launches, but consider extending the wrapper with your
|
||||||
# desired options instead.
|
# desired options instead.
|
||||||
#
|
|
||||||
# Although both dfhack and dwarf therapist are included in the lazy pack, you
|
with lib;
|
||||||
# can only use one at a time. DFHack does have therapist-like features, so this
|
|
||||||
# may or may not be a problem.
|
|
||||||
|
|
||||||
let
|
let
|
||||||
callPackage = pkgs.newScope self;
|
callPackage = pkgs.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.44.12";
|
||||||
|
|
||||||
|
# Converts a version to a package name.
|
||||||
|
versionToName = version: "dwarf-fortress_${lib.replaceStrings ["."] ["_"] version}";
|
||||||
|
|
||||||
|
# A map of names to each Dwarf Fortress package we know about.
|
||||||
df-games = lib.listToAttrs (map (dfVersion: {
|
df-games = lib.listToAttrs (map (dfVersion: {
|
||||||
name = "dwarf-fortress_${lib.replaceStrings ["."] ["_"] dfVersion}";
|
name = versionToName dfVersion;
|
||||||
value = callPackage ./wrapper {
|
value =
|
||||||
inherit (self) themes;
|
let
|
||||||
dwarf-fortress = callPackage ./game.nix { inherit dfVersion; };
|
# 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 (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
|
||||||
|
inherit dfVersion twbt;
|
||||||
|
stdenv = gccStdenv;
|
||||||
|
};
|
||||||
|
|
||||||
|
dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix {
|
||||||
|
inherit dwarf-fortress;
|
||||||
|
dwarf-therapist = pkgs.qt5.callPackage ./dwarf-therapist {
|
||||||
|
texlive = pkgs.texlive.combine {
|
||||||
|
inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
callPackage ./wrapper {
|
||||||
|
inherit (self) themes;
|
||||||
|
|
||||||
|
dwarf-fortress = dwarf-fortress;
|
||||||
|
dwarf-fortress-unfuck = dwarf-fortress-unfuck;
|
||||||
|
twbt = twbt;
|
||||||
|
dfhack = dfhack;
|
||||||
|
dwarf-therapist = dwarf-therapist;
|
||||||
|
};
|
||||||
}) (lib.attrNames self.df-hashes));
|
}) (lib.attrNames self.df-hashes));
|
||||||
|
|
||||||
self = rec {
|
self = rec {
|
||||||
df-hashes = builtins.fromJSON (builtins.readFile ./game.json);
|
df-hashes = builtins.fromJSON (builtins.readFile ./game.json);
|
||||||
dwarf-fortress = df-games.dwarf-fortress_0_44_12;
|
|
||||||
|
|
||||||
dwarf-fortress-full = callPackage ./lazy-pack.nix { };
|
# Aliases for the latest Dwarf Fortress and the selected Therapist install
|
||||||
|
dwarf-fortress = getAttr (versionToName latestVersion) df-games;
|
||||||
|
dwarf-therapist = dwarf-fortress.dwarf-therapist;
|
||||||
|
dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
|
||||||
|
|
||||||
dfhack = callPackage ./dfhack {
|
dwarf-fortress-full = callPackage ./lazy-pack.nix {
|
||||||
inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
|
inherit df-games versionToName latestVersion;
|
||||||
stdenv = gccStdenv;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
soundSense = callPackage ./soundsense.nix { };
|
soundSense = callPackage ./soundsense.nix { };
|
||||||
|
|
||||||
# unfuck is linux-only right now, we will only use it there.
|
|
||||||
dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { }
|
|
||||||
else null;
|
|
||||||
|
|
||||||
dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix {
|
|
||||||
inherit (dwarf-fortress) dwarf-fortress;
|
|
||||||
dwarf-therapist = pkgs.qt5.callPackage ./dwarf-therapist {
|
|
||||||
texlive = pkgs.texlive.combine {
|
|
||||||
inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
legends-browser = callPackage ./legends-browser {};
|
legends-browser = callPackage ./legends-browser {};
|
||||||
|
|
||||||
twbt = callPackage ./twbt {};
|
themes = recurseIntoAttrs (callPackage ./themes {
|
||||||
themes = recurseIntoAttrs (callPackage ./themes { });
|
stdenv = stdenvNoCC;
|
||||||
|
});
|
||||||
|
|
||||||
# aliases
|
# Theme aliases
|
||||||
phoebus-theme = themes.phoebus;
|
phoebus-theme = themes.phoebus;
|
||||||
cla-theme = themes.cla;
|
cla-theme = themes.cla;
|
||||||
dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in self // df-games
|
in self // df-games
|
||||||
|
@ -3,14 +3,62 @@
|
|||||||
, enableStoneSense ? false, allegro5, libGLU_combined
|
, enableStoneSense ? false, allegro5, libGLU_combined
|
||||||
, enableTWBT ? true, twbt
|
, enableTWBT ? true, twbt
|
||||||
, SDL
|
, SDL
|
||||||
|
, dfVersion
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
dfVersion = "0.44.12";
|
dfhack-releases = {
|
||||||
version = "${dfVersion}-r1";
|
"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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
release = if hasAttr dfVersion dfhack-releases
|
||||||
|
then getAttr dfVersion dfhack-releases
|
||||||
|
else throw "[DFHack] Unsupported Dwarf Fortress version: ${dfVersion}";
|
||||||
|
|
||||||
|
version = release.dfHackRelease;
|
||||||
|
|
||||||
|
warning = if release.prerelease then builtins.trace "[DFHack] Version ${version} is a prerelease. Careful!"
|
||||||
|
else null;
|
||||||
|
|
||||||
# revision of library/xml submodule
|
# revision of library/xml submodule
|
||||||
xmlRev = "23500e4e9bd1885365d0a2ef1746c321c1dd5094";
|
xmlRev = release.xmlRev;
|
||||||
|
|
||||||
arch =
|
arch =
|
||||||
if stdenv.hostPlatform.system == "x86_64-linux" then "64"
|
if stdenv.hostPlatform.system == "x86_64-linux" then "64"
|
||||||
@ -21,6 +69,10 @@ let
|
|||||||
#! ${stdenv.shell}
|
#! ${stdenv.shell}
|
||||||
if [ "$*" = "describe --tags --long" ]; then
|
if [ "$*" = "describe --tags --long" ]; then
|
||||||
echo "${version}-unknown"
|
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
|
elif [ "$*" = "rev-parse HEAD" ]; then
|
||||||
if [ "$(dirname "$(pwd)")" = "xml" ]; then
|
if [ "$(dirname "$(pwd)")" = "xml" ]; then
|
||||||
echo "${xmlRev}"
|
echo "${xmlRev}"
|
||||||
@ -41,8 +93,8 @@ let
|
|||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "DFHack";
|
owner = "DFHack";
|
||||||
repo = "dfhack";
|
repo = "dfhack";
|
||||||
sha256 = "0j03lq6j6w378z6cvm7jspxc7hhrqm8jaszlq0mzfvap0k13fgyy";
|
rev = release.dfHackRelease;
|
||||||
rev = version;
|
sha256 = release.sha256;
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
26
pkgs/games/dwarf-fortress/dwarf-therapist/dwarf-therapist.in
Normal file
26
pkgs/games/dwarf-fortress/dwarf-therapist/dwarf-therapist.in
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#!@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
|
||||||
|
|
||||||
|
QT_QPA_PLATFORM_PLUGIN_PATH="@qt_plugin_path@" \
|
||||||
|
exec "$therapist_dir/bin/dwarftherapist" "$@"
|
@ -1,33 +1,50 @@
|
|||||||
{ stdenv, symlinkJoin, dwarf-therapist, dwarf-fortress, makeWrapper }:
|
{ pkgs, stdenv, symlinkJoin, lib, dwarf-therapist, dwarf-fortress, makeWrapper }:
|
||||||
|
|
||||||
let
|
let
|
||||||
platformSlug = if stdenv.targetPlatform.is32bit then
|
platformSlug = if stdenv.targetPlatform.is32bit then
|
||||||
"linux32" else "linux64";
|
"linux32" else "linux64";
|
||||||
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
|
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
|
||||||
|
|
||||||
in symlinkJoin {
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
name = "dwarf-therapist-${dwarf-therapist.version}";
|
name = "dwarf-therapist-${dwarf-therapist.version}";
|
||||||
|
|
||||||
|
wrapper = ./dwarf-therapist.in;
|
||||||
|
|
||||||
paths = [ dwarf-therapist ];
|
paths = [ dwarf-therapist ];
|
||||||
|
|
||||||
buildInputs = [ makeWrapper ];
|
buildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
||||||
|
|
||||||
postBuild = ''
|
buildCommand = ''
|
||||||
# DwarfTherapist assumes it's run in $out/share/dwarftherapist and
|
mkdir -p $out/bin
|
||||||
# therefore uses many relative paths.
|
|
||||||
wrapProgram $out/bin/dwarftherapist \
|
|
||||||
--run "cd $out/share/dwarftherapist"
|
|
||||||
ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
|
ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
|
||||||
|
substitute $wrapper $out/bin/dwarftherapist \
|
||||||
|
--subst-var-by stdenv_shell ${stdenv.shell} \
|
||||||
|
--subst-var-by install $out \
|
||||||
|
--subst-var-by therapist ${dwarf-therapist} \
|
||||||
|
--subst-var-by qt_plugin_path "${pkgs.qt5.qtbase}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins/platforms"
|
||||||
|
|
||||||
|
chmod 755 $out/bin/dwarftherapist
|
||||||
|
|
||||||
|
# Fix up memory layouts
|
||||||
rm -rf $out/share/dwarftherapist/memory_layouts/linux
|
rm -rf $out/share/dwarftherapist/memory_layouts/linux
|
||||||
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
|
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
|
||||||
origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
|
orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
|
||||||
patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
|
patched_md5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
|
||||||
substitute \
|
input_file="${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile}"
|
||||||
${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \
|
output_file="$out/share/dwarftherapist/memory_layouts/${inifile}"
|
||||||
$out/share/dwarftherapist/memory_layouts/${inifile} \
|
|
||||||
--replace "$origmd5" "$patchedmd5"
|
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;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,6 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
assert dwarf-fortress-unfuck != null ->
|
|
||||||
dwarf-fortress-unfuck.dfVersion == dfVersion;
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "dwarf-fortress-${dfVersion}";
|
name = "dwarf-fortress-${dfVersion}";
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
{ stdenvNoCC, lib, buildEnv
|
{ stdenvNoCC, lib, buildEnv, callPackage
|
||||||
, dwarf-fortress, themes
|
, df-games, themes, latestVersion, versionToName
|
||||||
|
, dfVersion ? latestVersion
|
||||||
# This package should, at any given time, provide an opinionated "optimal"
|
# 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
|
# DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and
|
||||||
# should contain every utility available.
|
# should contain every utility available unless you disable them.
|
||||||
, enableDFHack ? stdenvNoCC.isLinux
|
, enableDFHack ? stdenvNoCC.isLinux
|
||||||
, enableTWBT ? enableDFHack
|
, enableTWBT ? enableDFHack
|
||||||
, enableSoundSense ? true
|
, enableSoundSense ? true
|
||||||
, enableStoneSense ? false # StoneSense is currently broken.
|
, enableStoneSense ? true
|
||||||
, enableDwarfTherapist ? true, dwarf-therapist
|
, enableDwarfTherapist ? true
|
||||||
, enableLegendsBrowser ? true, legends-browser
|
, enableLegendsBrowser ? true, legends-browser
|
||||||
, theme ? themes.phoebus
|
, theme ? themes.phoebus
|
||||||
# General config options:
|
# General config options:
|
||||||
@ -16,6 +17,15 @@
|
|||||||
, enableFPS ? false
|
, enableFPS ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
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 {
|
buildEnv {
|
||||||
name = "dwarf-fortress-full";
|
name = "dwarf-fortress-full";
|
||||||
paths = [
|
paths = [
|
||||||
@ -28,7 +38,7 @@ buildEnv {
|
|||||||
|
|
||||||
meta = with stdenvNoCC.lib; {
|
meta = with stdenvNoCC.lib; {
|
||||||
description = "An opinionated wrapper for Dwarf Fortress";
|
description = "An opinionated wrapper for Dwarf Fortress";
|
||||||
maintainers = with maintainers; [ Baughn ];
|
maintainers = with maintainers; [ Baughn numinit ];
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
homepage = https://github.com/NixOS/nixpkgs/;
|
homepage = https://github.com/NixOS/nixpkgs/;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{lib, fetchFromGitHub}:
|
{lib, fetchFromGitHub, ...}:
|
||||||
|
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
|
@ -1,14 +1,59 @@
|
|||||||
{ stdenvNoCC, fetchurl, unzip }:
|
{ 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
release = if hasAttr dfVersion twbt-releases
|
||||||
|
then getAttr dfVersion twbt-releases
|
||||||
|
else throw "[TWBT] Unsupported Dwarf Fortress version: ${dfVersion}";
|
||||||
|
|
||||||
|
warning = if release.prerelease then builtins.trace "[TWBT] Version ${version} is a prerelease. Careful!"
|
||||||
|
else null;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenvNoCC.mkDerivation rec {
|
||||||
name = "twbt-${version}";
|
name = "twbt-${version}";
|
||||||
version = "6.54";
|
version = release.twbtRelease;
|
||||||
dfVersion = "0.44.12";
|
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
|
url = "https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
|
||||||
sha256 = "10gfd6vv0vk4v1r5hjbz7vf1zqys06dsad695gysc7fbcik2dakh";
|
sha256 = release.sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
sourceRoot = ".";
|
sourceRoot = ".";
|
||||||
@ -24,10 +69,9 @@ stdenvNoCC.mkDerivation rec {
|
|||||||
cp -a *.png $art/data/art/
|
cp -a *.png $art/data/art/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
meta = with stdenvNoCC.lib; {
|
meta = with stdenvNoCC.lib; {
|
||||||
description = "A plugin for Dwarf Fortress / DFHack that improves various aspects the game interface.";
|
description = "A plugin for Dwarf Fortress / DFHack that improves various aspects the game interface.";
|
||||||
maintainers = with maintainers; [ Baughn ];
|
maintainers = with maintainers; [ Baughn numinit ];
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
homepage = https://github.com/mifki/df-twbt;
|
homepage = https://github.com/mifki/df-twbt;
|
||||||
|
@ -1,18 +1,52 @@
|
|||||||
{ stdenv, fetchFromGitHub, cmake
|
{ stdenv, lib, fetchFromGitHub, cmake
|
||||||
, libGL, libSM, SDL, SDL_image, SDL_ttf, glew, openalSoft
|
, libGL, libSM, SDL, SDL_image, SDL_ttf, glew, openalSoft
|
||||||
, ncurses, glib, gtk2, libsndfile, zlib
|
, ncurses, glib, gtk2, libsndfile, zlib
|
||||||
|
, dfVersion
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let dfVersion = "0.44.12"; in
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
release = if hasAttr dfVersion unfuck-releases
|
||||||
|
then getAttr dfVersion unfuck-releases
|
||||||
|
else throw "[unfuck] Unknown Dwarf Fortress version: ${dfVersion}";
|
||||||
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "dwarf_fortress_unfuck-${dfVersion}";
|
name = "dwarf_fortress_unfuck-${release.unfuckRelease}";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "svenstaro";
|
owner = "svenstaro";
|
||||||
repo = "dwarf_fortress_unfuck";
|
repo = "dwarf_fortress_unfuck";
|
||||||
rev = dfVersion;
|
rev = release.unfuckRelease;
|
||||||
sha256 = "1kszkb1d1vll8p04ja41nangsaxb5lv4p3xh2jhmsmipfixw7nvz";
|
sha256 = release.sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
@ -20,23 +54,12 @@ stdenv.mkDerivation {
|
|||||||
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
|
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
|
||||||
];
|
];
|
||||||
|
|
||||||
makeFlags = [
|
|
||||||
''CFLAGS="-fkeep-inline-functions"''
|
|
||||||
''CXXFLAGS="-fkeep-inline-functions"''
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
libSM SDL SDL_image SDL_ttf glew openalSoft
|
libSM SDL SDL_image SDL_ttf glew openalSoft
|
||||||
ncurses gtk2 libsndfile zlib libGL
|
ncurses gtk2 libsndfile zlib libGL
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
substituteInPlace CMakeLists.txt --replace \
|
|
||||||
'set(CMAKE_BUILD_TYPE Release)' \
|
|
||||||
'set(CMAKE_BUILD_TYPE Debug)'
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Don't strip unused symbols; dfhack hooks into some of them.
|
# Don't strip unused symbols; dfhack hooks into some of them.
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
|
|
||||||
@ -56,6 +79,6 @@ stdenv.mkDerivation {
|
|||||||
homepage = https://github.com/svenstaro/dwarf_fortress_unfuck;
|
homepage = https://github.com/svenstaro/dwarf_fortress_unfuck;
|
||||||
license = licenses.free;
|
license = licenses.free;
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
maintainers = with maintainers; [ abbradar ];
|
maintainers = with maintainers; [ abbradar numinit ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{ stdenv, lib, buildEnv, dwarf-fortress, substituteAll
|
{ stdenv, lib, buildEnv, substituteAll
|
||||||
|
, dwarf-fortress, dwarf-fortress-unfuck
|
||||||
|
, dwarf-therapist
|
||||||
, enableDFHack ? false, dfhack
|
, enableDFHack ? false, dfhack
|
||||||
, enableSoundSense ? false, soundSense, jdk
|
, enableSoundSense ? false, soundSense, jdk
|
||||||
, enableStoneSense ? false
|
, enableStoneSense ? false
|
||||||
@ -36,18 +38,29 @@ let
|
|||||||
|
|
||||||
paths = themePkg ++ pkgs;
|
paths = themePkg ++ pkgs;
|
||||||
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
||||||
ignoreCollisions = true;
|
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
# De-symlink init.txt
|
# De-symlink init.txt
|
||||||
cp $out/data/init/init.txt init.txt
|
cp $out/data/init/init.txt init.txt
|
||||||
rm $out/data/init/init.txt
|
rm -f $out/data/init/init.txt
|
||||||
mv init.txt $out/data/init/init.txt
|
mv init.txt $out/data/init/init.txt
|
||||||
'' + lib.optionalString enableDFHack ''
|
'' + lib.optionalString enableDFHack ''
|
||||||
|
# De-symlink symbols.xml
|
||||||
rm $out/hack/symbols.xml
|
rm $out/hack/symbols.xml
|
||||||
substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \
|
|
||||||
--replace $(cat ${dwarf-fortress}/hash.md5.orig) \
|
# Patch the MD5
|
||||||
$(cat ${dwarf-fortress}/hash.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 ''
|
'' + lib.optionalString enableTWBT ''
|
||||||
substituteInPlace $out/data/init/init.txt \
|
substituteInPlace $out/data/init/init.txt \
|
||||||
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
|
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
|
||||||
@ -57,14 +70,14 @@ let
|
|||||||
--replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
|
--replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
|
||||||
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]'
|
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
ignoreCollisions = true;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "dwarf-fortress-${dwarf-fortress.dfVersion}";
|
name = "dwarf-fortress-${dwarf-fortress.dfVersion}";
|
||||||
|
|
||||||
compatible = lib.all (x: assert (x.dfVersion == dwarf-fortress.dfVersion); true) pkgs;
|
|
||||||
|
|
||||||
dfInit = substituteAll {
|
dfInit = substituteAll {
|
||||||
name = "dwarf-fortress-init";
|
name = "dwarf-fortress-init";
|
||||||
src = ./dwarf-fortress-init.in;
|
src = ./dwarf-fortress-init.in;
|
||||||
@ -77,7 +90,7 @@ stdenv.mkDerivation rec {
|
|||||||
runDFHack = ./dfhack.in;
|
runDFHack = ./dfhack.in;
|
||||||
runSoundSense = ./soundSense.in;
|
runSoundSense = ./soundSense.in;
|
||||||
|
|
||||||
passthru = { inherit dwarf-fortress; };
|
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user