dwarf-fortress: refactors
This will make it easier for people to access old versions. You can now access attributes like: - dwarf-fortress_0_44_11 - dwarf-fortress_0_43_05 - etc.
This commit is contained in:
parent
cdd0ac7e54
commit
530427c7ab
|
@ -1,12 +1,19 @@
|
|||
{ pkgs, stdenv, stdenvNoCC, gccStdenv }:
|
||||
{ pkgs, stdenv, stdenvNoCC, gccStdenv, lib }:
|
||||
|
||||
let
|
||||
callPackage = pkgs.newScope self;
|
||||
|
||||
self = rec {
|
||||
dwarf-fortress-original = callPackage ./game.nix {
|
||||
dfVersion = "0.44.11";
|
||||
df-games = lib.listToAttrs (map (dfVersion: {
|
||||
name = "dwarf-fortress_${lib.replaceStrings ["."] ["_"] dfVersion}";
|
||||
value = callPackage ./wrapper {
|
||||
inherit (self) themes;
|
||||
dwarf-fortress = callPackage ./game.nix { inherit dfVersion; };
|
||||
};
|
||||
}) (lib.attrNames self.df-hashes));
|
||||
|
||||
self = rec {
|
||||
df-hashes = builtins.fromJSON (builtins.readFile ./game.json);
|
||||
dwarf-fortress = df-games.dwarf-fortress_0_44_11;
|
||||
|
||||
dfhack = callPackage ./dfhack {
|
||||
inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
|
||||
|
@ -17,29 +24,27 @@ let
|
|||
|
||||
# unfuck is linux-only right now, we will just use it there
|
||||
dwarf-fortress-unfuck = if stdenv.isLinux then callPackage ./unfuck.nix { }
|
||||
else null;
|
||||
else null;
|
||||
|
||||
dwarf-fortress = callPackage ./wrapper {
|
||||
inherit themes;
|
||||
};
|
||||
|
||||
dwarf-therapist-original = pkgs.qt5.callPackage ./dwarf-therapist {
|
||||
texlive = pkgs.texlive.combine {
|
||||
inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix { };
|
||||
|
||||
legends-browser = callPackage ./legends-browser {};
|
||||
|
||||
themes = callPackage ./themes {
|
||||
stdenv = stdenvNoCC;
|
||||
};
|
||||
|
||||
# aliases
|
||||
phoebus-theme = themes.phoebus;
|
||||
|
||||
cla-theme = themes.cla;
|
||||
dwarf-fortress-original = dwarf-fortress.dwarf-fortress;
|
||||
};
|
||||
|
||||
in self
|
||||
in self // df-games
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ stdenv, fetchFromGitHub, coreutils, qtbase, qtdeclarative, cmake, texlive, ninja }:
|
||||
{ stdenv, fetchFromGitHub, coreutils, qtbase
|
||||
, qtdeclarative, cmake, texlive, ninja }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "dwarf-therapist-original-${version}";
|
||||
name = "dwarf-therapist-${version}";
|
||||
version = "40.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
{ stdenv, symlinkJoin, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }:
|
||||
{ stdenv, symlinkJoin, lib, dwarf-therapist, dwarf-fortress, makeWrapper }:
|
||||
|
||||
let
|
||||
df = dwarf-fortress-original;
|
||||
dt = dwarf-therapist-original;
|
||||
platformSlug = if stdenv.targetPlatform.is32bit then
|
||||
"linux32" else "linux64";
|
||||
inifile = "linux/v0.${df.baseVersion}.${df.patchVersion}_${platformSlug}.ini";
|
||||
dfHashFile = "${df}/hash.md5";
|
||||
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
|
||||
|
||||
in symlinkJoin {
|
||||
name = "dwarf-therapist-${dt.version}";
|
||||
name = "dwarf-therapist-${dwarf-therapist.version}";
|
||||
|
||||
paths = [ dt ];
|
||||
paths = [ dwarf-therapist ];
|
||||
|
||||
buildInputs = [ makeWrapper ];
|
||||
|
||||
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
||||
|
||||
postBuild = ''
|
||||
# DwarfTherapist assumes it's run in $out/share/dwarftherapist and
|
||||
# therefore uses many relative paths.
|
||||
|
@ -23,10 +22,10 @@ in symlinkJoin {
|
|||
|
||||
rm -rf $out/share/dwarftherapist/memory_layouts/linux
|
||||
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
|
||||
origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8)
|
||||
patchedmd5=$(cat "${dfHashFile}" | cut -c1-8)
|
||||
origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
|
||||
patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
|
||||
substitute \
|
||||
${dt}/share/dwarftherapist/memory_layouts/${inifile} \
|
||||
${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \
|
||||
$out/share/dwarftherapist/memory_layouts/${inifile} \
|
||||
--replace "$origmd5" "$patchedmd5"
|
||||
'';
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
# Our own "unfuck" libs for macOS
|
||||
, ncurses, fmodex, gcc
|
||||
|
||||
, dfVersion
|
||||
, dfVersion, df-hashes
|
||||
}:
|
||||
|
||||
with lib; with builtins;
|
||||
with lib;
|
||||
|
||||
let
|
||||
libpath = makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc dwarf-fortress-unfuck SDL ];
|
||||
|
@ -30,9 +30,8 @@ let
|
|||
baseVersion = elemAt dfVersionTriple 1;
|
||||
patchVersion = elemAt dfVersionTriple 2;
|
||||
|
||||
games = fromJSON (readFile ./game.json);
|
||||
game = if hasAttr dfVersion games
|
||||
then getAttr dfVersion games
|
||||
game = if hasAttr dfVersion df-hashes
|
||||
then getAttr dfVersion df-hashes
|
||||
else throw "Unknown Dwarf Fortress version: ${dfVersion}";
|
||||
dfPlatform = if hasAttr stdenv.system platforms
|
||||
then getAttr stdenv.system platforms
|
||||
|
@ -47,7 +46,7 @@ assert dwarf-fortress-unfuck != null ->
|
|||
dwarf-fortress-unfuck.dfVersion == dfVersion;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "dwarf-fortress-original-${dfVersion}";
|
||||
name = "dwarf-fortress-${dfVersion}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "${homepage}df_${baseVersion}_${patchVersion}_${dfPlatform}.tar.bz2";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, lib, buildEnv, dwarf-fortress-original, substituteAll
|
||||
{ stdenv, lib, buildEnv, dwarf-fortress, substituteAll
|
||||
, enableDFHack ? false, dfhack
|
||||
, enableSoundSense ? false, soundSense, jdk
|
||||
, enableStoneSense ? false
|
||||
|
@ -20,10 +20,10 @@ let
|
|||
themePkg = lib.optional (theme != null) ptheme;
|
||||
pkgs = lib.optional enableDFHack dfhack_
|
||||
++ lib.optional enableSoundSense soundSense
|
||||
++ [ dwarf-fortress-original ];
|
||||
++ [ dwarf-fortress ];
|
||||
|
||||
env = buildEnv {
|
||||
name = "dwarf-fortress-env-${dwarf-fortress-original.dfVersion}";
|
||||
name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}";
|
||||
|
||||
paths = themePkg ++ pkgs;
|
||||
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
||||
|
@ -32,16 +32,16 @@ let
|
|||
postBuild = lib.optionalString enableDFHack ''
|
||||
rm $out/hack/symbols.xml
|
||||
substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \
|
||||
--replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \
|
||||
$(cat ${dwarf-fortress-original}/hash.md5)
|
||||
--replace $(cat ${dwarf-fortress}/hash.md5.orig) \
|
||||
$(cat ${dwarf-fortress}/hash.md5)
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "dwarf-fortress-${dwarf-fortress-original.dfVersion}";
|
||||
name = "dwarf-fortress-${dwarf-fortress.dfVersion}";
|
||||
|
||||
compatible = lib.all (x: assert (x.dfVersion == dwarf-fortress-original.dfVersion); true) pkgs;
|
||||
compatible = lib.all (x: assert (x.dfVersion == dwarf-fortress.dfVersion); true) pkgs;
|
||||
|
||||
dfInit = substituteAll {
|
||||
name = "dwarf-fortress-init";
|
||||
|
@ -55,6 +55,8 @@ stdenv.mkDerivation rec {
|
|||
runDFHack = ./dfhack.in;
|
||||
runSoundSense = ./soundSense.in;
|
||||
|
||||
passthru = { inherit dwarf-fortress; };
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
|
|
Loading…
Reference in a new issue