mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 22:32:58 +03:00
Merge pull request #84873 from mnacamura/cdda-mods
cataclysmDDA: add modding interface
This commit is contained in:
commit
8b6e9818a5
@ -1,4 +1,4 @@
|
||||
MD_TARGETS=$(addsuffix .xml, $(basename $(wildcard ./*.md ./**/*.md)))
|
||||
MD_TARGETS=$(addsuffix .xml, $(basename $(shell find . -type f -regex '.*\.md$$')))
|
||||
|
||||
.PHONY: all
|
||||
all: validate format out/html/index.html out/epub/manual.epub
|
||||
|
94
doc/builders/packages/cataclysm-dda.section.md
Normal file
94
doc/builders/packages/cataclysm-dda.section.md
Normal file
@ -0,0 +1,94 @@
|
||||
# Cataclysm: Dark Days Ahead
|
||||
|
||||
## How to install Cataclysm DDA
|
||||
|
||||
To install the latest stable release of Cataclysm DDA to your profile, execute
|
||||
`nix-env -f "<nixpkgs>" -iA cataclysm-dda`. For the curses build (build
|
||||
without tiles), install `cataclysmDDA.stable.curses`. Note: `cataclysm-dda` is
|
||||
an alias to `cataclysmDDA.stable.tiles`.
|
||||
|
||||
If you like access to a development build of your favorite git revision,
|
||||
override `cataclysm-dda-git` (or `cataclysmDDA.git.curses` if you like curses
|
||||
build):
|
||||
|
||||
```nix
|
||||
cataclysm-dda-git.override {
|
||||
version = "YYYY-MM-DD";
|
||||
rev = "YOUR_FAVORITE_REVISION";
|
||||
sha256 = "CHECKSUM_OF_THE_REVISION";
|
||||
}
|
||||
```
|
||||
|
||||
The sha256 checksum can be obtained by
|
||||
|
||||
```sh
|
||||
nix-prefetch-url --unpack "https://github.com/CleverRaven/Cataclysm-DDA/archive/${YOUR_FAVORITE_REVISION}.tar.gz"
|
||||
```
|
||||
|
||||
The default configuration directory is `~/.cataclysm-dda`. If you prefer
|
||||
`$XDG_CONFIG_HOME/cataclysm-dda`, override the derivation:
|
||||
|
||||
```nix
|
||||
cataclysm-dda.override {
|
||||
useXdgDir = true;
|
||||
}
|
||||
```
|
||||
|
||||
## Customizing with mods
|
||||
|
||||
To install Cataclysm DDA with mods of your choice, you can use `withMods`
|
||||
attribute:
|
||||
|
||||
```nix
|
||||
cataclysm-dda.withMods (mods: with mods; [
|
||||
tileset.UndeadPeople
|
||||
])
|
||||
```
|
||||
|
||||
All mods, soundpacks, and tilesets available in nixpkgs are found in
|
||||
`cataclysmDDA.pkgs`.
|
||||
|
||||
Here is an example to modify existing mods and/or add more mods not available
|
||||
in nixpkgs:
|
||||
|
||||
```nix
|
||||
let
|
||||
customMods = self: super: lib.recursiveUpdate super {
|
||||
# Modify existing mod
|
||||
tileset.UndeadPeople = super.tileset.UndeadPeople.overrideAttrs (old: {
|
||||
# If you like to apply a patch to the tileset for example
|
||||
patches = [ ./path/to/your.patch ];
|
||||
});
|
||||
|
||||
# Add another mod
|
||||
mod.Awesome = cataclysmDDA.buildMod {
|
||||
modName = "Awesome";
|
||||
version = "0.x";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Someone";
|
||||
repo = "AwesomeMod";
|
||||
rev = "...";
|
||||
sha256 = "...";
|
||||
};
|
||||
# Path to be installed in the unpacked source (default: ".")
|
||||
modRoot = "contents/under/this/path/will/be/installed";
|
||||
};
|
||||
|
||||
# Add another soundpack
|
||||
soundpack.Fantastic = cataclysmDDA.buildSoundPack {
|
||||
# ditto
|
||||
};
|
||||
|
||||
# Add another tileset
|
||||
tileset.SuperDuper = cataclysmDDA.buildTileSet {
|
||||
# ditto
|
||||
};
|
||||
};
|
||||
in
|
||||
cataclysm-dda.withMods (mods: with mods.extend customMods; [
|
||||
tileset.UndeadPeople
|
||||
mod.Awesome
|
||||
soundpack.Fantastic
|
||||
tileset.SuperDuper
|
||||
])
|
||||
```
|
@ -18,6 +18,7 @@
|
||||
<xi:include href="opengl.xml" />
|
||||
<xi:include href="shell-helpers.xml" />
|
||||
<xi:include href="steam.xml" />
|
||||
<xi:include href="cataclysm-dda.section.xml" />
|
||||
<xi:include href="urxvt.xml" />
|
||||
<xi:include href="weechat.xml" />
|
||||
<xi:include href="xorg.xml" />
|
||||
|
49
pkgs/games/cataclysm-dda/builder.nix
Normal file
49
pkgs/games/cataclysm-dda/builder.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ stdenvNoCC, lib, type }:
|
||||
|
||||
assert lib.elem type [
|
||||
"mod"
|
||||
"soundpack"
|
||||
"tileset"
|
||||
];
|
||||
|
||||
{ modName, version, src, ... } @ args:
|
||||
|
||||
stdenvNoCC.mkDerivation (args // rec {
|
||||
pname = args.pname or "cataclysm-dda-${type}-${modName}";
|
||||
|
||||
modRoot = args.modRoot or ".";
|
||||
|
||||
configurePhase = args.configurePhase or ''
|
||||
runHook preConfigure
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = args.buildPhase or ''
|
||||
runHook preBuild
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
checkPhase = args.checkPhase or ''
|
||||
runHook preCheck
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = let
|
||||
baseDir = {
|
||||
mod = "mods";
|
||||
soundpack = "sound";
|
||||
tileset = "gfx";
|
||||
}.${type};
|
||||
in args.installPhase or ''
|
||||
runHook preInstall
|
||||
destdir="$out/share/cataclysm-dda/${baseDir}"
|
||||
mkdir -p "$destdir"
|
||||
cp -R "${modRoot}" "$destdir/${modName}"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
forTiles = true;
|
||||
forCurses = type == "mod";
|
||||
};
|
||||
})
|
@ -1,6 +1,7 @@
|
||||
{ stdenv, fetchFromGitHub, pkgconfig, gettext, ncurses, CoreFoundation
|
||||
{ stdenv, runtimeShell, pkgconfig, gettext, ncurses, CoreFoundation
|
||||
, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa
|
||||
, debug, runtimeShell
|
||||
, debug
|
||||
, useXdgDir
|
||||
}:
|
||||
|
||||
let
|
||||
@ -12,98 +13,100 @@ let
|
||||
tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ]
|
||||
++ optionals stdenv.isDarwin [ Cocoa ];
|
||||
|
||||
common = {
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
installXDGAppLauncher = ''
|
||||
launcher="$out/share/applications/cataclysm-dda.desktop"
|
||||
install -D -m 444 data/xdg/*cataclysm-dda.desktop -T "$launcher"
|
||||
sed -i "$launcher" -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
|
||||
install -D -m 444 data/xdg/cataclysm-dda.svg -t $out/share/icons/hicolor/scalable/apps
|
||||
'';
|
||||
|
||||
buildInputs = cursesDeps ++ optionals tiles tilesDeps;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=$(out)" "USE_HOME_DIR=1" "LANGUAGES=all"
|
||||
] ++ optionals (!debug) [
|
||||
"RELEASE=1"
|
||||
] ++ optionals tiles [
|
||||
"TILES=1" "SOUND=1"
|
||||
] ++ optionals stdenv.isDarwin [
|
||||
"NATIVE=osx" "CLANG=1"
|
||||
];
|
||||
|
||||
postInstall = optionalString tiles
|
||||
( if !stdenv.isDarwin
|
||||
then utils.installXDGAppLauncher
|
||||
else utils.installMacOSAppLauncher
|
||||
);
|
||||
|
||||
dontStrip = debug;
|
||||
|
||||
# https://hydra.nixos.org/build/65193254
|
||||
# src/weather_data.cpp:203:1: fatal error: opening dependency file obj/tiles/weather_data.d: No such file or directory
|
||||
# make: *** [Makefile:687: obj/tiles/weather_data.o] Error 1
|
||||
enableParallelBuilding = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A free, post apocalyptic, zombie infested rogue-like";
|
||||
longDescription = ''
|
||||
Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world.
|
||||
Surviving is difficult: you have been thrown, ill-equipped, into a
|
||||
landscape now riddled with monstrosities of which flesh eating zombies are
|
||||
neither the strangest nor the deadliest.
|
||||
|
||||
Yet with care and a little luck, many things are possible. You may try to
|
||||
eke out an existence in the forests silently executing threats and
|
||||
providing sustenance with your longbow. You can ride into town in a
|
||||
jerry-rigged vehicle, all guns blazing, to settle matters in a fug of
|
||||
smoke from your molotovs. You could take a more measured approach and
|
||||
construct an impregnable fortress, surrounded by traps to protect you from
|
||||
the horrors without. The longer you survive, the more skilled and adapted
|
||||
you will get and the better equipped and armed to deal with the threats
|
||||
you are presented with.
|
||||
|
||||
In the course of your ordeal there will be opportunities and temptations
|
||||
to improve or change your very nature. There are tales of survivors fitted
|
||||
with extraordinary cybernetics giving great power and stories too of
|
||||
gravely mutated survivors who, warped by their ingestion of exotic
|
||||
substances or radiation, now more closely resemble insects, birds or fish
|
||||
than their original form.
|
||||
'';
|
||||
homepage = "https://cataclysmdda.org/";
|
||||
license = licenses.cc-by-sa-30;
|
||||
maintainers = with maintainers; [ mnacamura ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
utils = {
|
||||
fetchFromCleverRaven = { rev, sha256 }:
|
||||
fetchFromGitHub {
|
||||
owner = "CleverRaven";
|
||||
repo = "Cataclysm-DDA";
|
||||
inherit rev sha256;
|
||||
};
|
||||
|
||||
installXDGAppLauncher = ''
|
||||
launcher="$out/share/applications/cataclysm-dda.desktop"
|
||||
install -D -m 444 data/xdg/*cataclysm-dda.desktop -T "$launcher"
|
||||
sed -i "$launcher" -e "s,\(Exec=\)\(cataclysm-tiles\),\1$out/bin/\2,"
|
||||
install -D -m 444 data/xdg/cataclysm-dda.svg -t $out/share/icons/hicolor/scalable/apps
|
||||
'';
|
||||
|
||||
installMacOSAppLauncher = ''
|
||||
app=$out/Applications/Cataclysm.app
|
||||
install -D -m 444 data/osx/Info.plist -t $app/Contents
|
||||
install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
|
||||
mkdir $app/Contents/MacOS
|
||||
launcher=$app/Contents/MacOS/Cataclysm.sh
|
||||
cat << EOF > $launcher
|
||||
#!${runtimeShell}
|
||||
$out/bin/cataclysm-tiles
|
||||
EOF
|
||||
chmod 555 $launcher
|
||||
'';
|
||||
};
|
||||
installMacOSAppLauncher = ''
|
||||
app=$out/Applications/Cataclysm.app
|
||||
install -D -m 444 data/osx/Info.plist -t $app/Contents
|
||||
install -D -m 444 data/osx/AppIcon.icns -t $app/Contents/Resources
|
||||
mkdir $app/Contents/MacOS
|
||||
launcher=$app/Contents/MacOS/Cataclysm.sh
|
||||
cat << EOF > $launcher
|
||||
#!${runtimeShell}
|
||||
$out/bin/cataclysm-tiles
|
||||
EOF
|
||||
chmod 555 $launcher
|
||||
'';
|
||||
in
|
||||
|
||||
{ inherit common utils; }
|
||||
stdenv.mkDerivation {
|
||||
pname = "cataclysm-dda";
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = cursesDeps ++ optionals tiles tilesDeps;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
# Locale patch required for Darwin builds, see:
|
||||
# https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970
|
||||
sed -i src/translations.cpp \
|
||||
-e 's@#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))@#elif 1@'
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=$(out)" "LANGUAGES=all"
|
||||
(if useXdgDir then "USE_XDG_DIR=1" else "USE_HOME_DIR=1")
|
||||
] ++ optionals (!debug) [
|
||||
"RELEASE=1"
|
||||
] ++ optionals tiles [
|
||||
"TILES=1" "SOUND=1"
|
||||
] ++ optionals stdenv.isDarwin [
|
||||
"NATIVE=osx" "CLANG=1"
|
||||
];
|
||||
|
||||
postInstall = optionalString tiles
|
||||
( if !stdenv.isDarwin
|
||||
then installXDGAppLauncher
|
||||
else installMacOSAppLauncher
|
||||
);
|
||||
|
||||
dontStrip = debug;
|
||||
|
||||
# https://hydra.nixos.org/build/65193254
|
||||
# src/weather_data.cpp:203:1: fatal error: opening dependency file obj/tiles/weather_data.d: No such file or directory
|
||||
# make: *** [Makefile:687: obj/tiles/weather_data.o] Error 1
|
||||
enableParallelBuilding = false;
|
||||
|
||||
passthru = {
|
||||
isTiles = tiles;
|
||||
isCurses = !tiles;
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A free, post apocalyptic, zombie infested rogue-like";
|
||||
longDescription = ''
|
||||
Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world.
|
||||
Surviving is difficult: you have been thrown, ill-equipped, into a
|
||||
landscape now riddled with monstrosities of which flesh eating zombies are
|
||||
neither the strangest nor the deadliest.
|
||||
|
||||
Yet with care and a little luck, many things are possible. You may try to
|
||||
eke out an existence in the forests silently executing threats and
|
||||
providing sustenance with your longbow. You can ride into town in a
|
||||
jerry-rigged vehicle, all guns blazing, to settle matters in a fug of
|
||||
smoke from your molotovs. You could take a more measured approach and
|
||||
construct an impregnable fortress, surrounded by traps to protect you from
|
||||
the horrors without. The longer you survive, the more skilled and adapted
|
||||
you will get and the better equipped and armed to deal with the threats
|
||||
you are presented with.
|
||||
|
||||
In the course of your ordeal there will be opportunities and temptations
|
||||
to improve or change your very nature. There are tales of survivors fitted
|
||||
with extraordinary cybernetics giving great power and stories too of
|
||||
gravely mutated survivors who, warped by their ingestion of exotic
|
||||
substances or radiation, now more closely resemble insects, birds or fish
|
||||
than their original form.
|
||||
'';
|
||||
homepage = "https://cataclysmdda.org/";
|
||||
license = licenses.cc-by-sa-30;
|
||||
maintainers = with maintainers; [ mnacamura ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
|
@ -1,25 +1,42 @@
|
||||
{ stdenv, callPackage, CoreFoundation
|
||||
, tiles ? true, Cocoa
|
||||
, debug ? false
|
||||
}:
|
||||
{ newScope, darwin }:
|
||||
|
||||
let
|
||||
inherit (callPackage ./common.nix { inherit tiles CoreFoundation Cocoa debug; }) common utils;
|
||||
inherit (utils) fetchFromCleverRaven;
|
||||
callPackage = newScope self;
|
||||
|
||||
stable = rec {
|
||||
tiles = callPackage ./stable.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
|
||||
};
|
||||
|
||||
curses = tiles.override { tiles = false; };
|
||||
};
|
||||
|
||||
git = rec {
|
||||
tiles = callPackage ./git.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
|
||||
};
|
||||
|
||||
curses = tiles.override { tiles = false; };
|
||||
};
|
||||
|
||||
lib = callPackage ./lib.nix {};
|
||||
|
||||
pkgs = callPackage ./pkgs {};
|
||||
|
||||
self = {
|
||||
inherit
|
||||
callPackage
|
||||
stable
|
||||
git;
|
||||
|
||||
inherit (lib)
|
||||
buildMod
|
||||
buildSoundPack
|
||||
buildTileSet
|
||||
wrapCDDA;
|
||||
|
||||
inherit pkgs;
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (common // rec {
|
||||
version = "0.E-2";
|
||||
name = "cataclysm-dda-${version}";
|
||||
|
||||
src = fetchFromCleverRaven {
|
||||
rev = version;
|
||||
sha256 = "15l6w6lxays7qmsv0ci2ry53asb9an9dh7l7fc13256k085qcg68";
|
||||
};
|
||||
|
||||
patches = [ ./patches/fix_locale_dir.patch ];
|
||||
|
||||
meta = with stdenv.lib.maintainers; common.meta // {
|
||||
maintainers = common.meta.maintainers ++ [ skeidel ];
|
||||
};
|
||||
})
|
||||
self
|
||||
|
@ -1,33 +1,41 @@
|
||||
{ stdenv, callPackage, CoreFoundation
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA
|
||||
, tiles ? true, Cocoa
|
||||
, debug ? false
|
||||
, useXdgDir ? false
|
||||
, version ? "2019-11-22"
|
||||
, rev ? "a6c8ece992bffeae3788425dd4b3b5871e66a9cd"
|
||||
, sha256 ? "0ww2q5gykxm802z1kffmnrfahjlx123j1gfszklpsv0b1fccm1ab"
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) substring;
|
||||
inherit (callPackage ./common.nix { inherit tiles CoreFoundation Cocoa debug; }) common utils;
|
||||
inherit (utils) fetchFromCleverRaven;
|
||||
common = callPackage ./common.nix {
|
||||
inherit CoreFoundation tiles Cocoa debug useXdgDir;
|
||||
};
|
||||
|
||||
self = common.overrideAttrs (common: rec {
|
||||
pname = common.pname + "-git";
|
||||
inherit version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "CleverRaven";
|
||||
repo = "Cataclysm-DDA";
|
||||
inherit rev sha256;
|
||||
};
|
||||
|
||||
makeFlags = common.makeFlags ++ [
|
||||
"VERSION=git-${version}-${lib.substring 0 8 src.rev}"
|
||||
];
|
||||
|
||||
passthru = common.passthru // {
|
||||
pkgs = pkgs.override { build = self; };
|
||||
withMods = wrapCDDA self;
|
||||
};
|
||||
|
||||
meta = common.meta // {
|
||||
maintainers = with lib.maintainers;
|
||||
common.meta.maintainers ++ [ rardiol ];
|
||||
};
|
||||
});
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (common // rec {
|
||||
version = "2019-11-22";
|
||||
name = "cataclysm-dda-git-${version}";
|
||||
|
||||
src = fetchFromCleverRaven {
|
||||
rev = "a6c8ece992bffeae3788425dd4b3b5871e66a9cd";
|
||||
sha256 = "0ww2q5gykxm802z1kffmnrfahjlx123j1gfszklpsv0b1fccm1ab";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Locale patch required for Darwin builds, see: https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970
|
||||
./patches/fix_locale_dir_git.patch
|
||||
];
|
||||
|
||||
makeFlags = common.makeFlags ++ [
|
||||
"VERSION=git-${version}-${substring 0 8 src.rev}"
|
||||
];
|
||||
|
||||
meta = with stdenv.lib.maintainers; common.meta // {
|
||||
maintainers = common.meta.maintainers ++ [ rardiol ];
|
||||
};
|
||||
})
|
||||
self
|
||||
|
17
pkgs/games/cataclysm-dda/lib.nix
Normal file
17
pkgs/games/cataclysm-dda/lib.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ callPackage }:
|
||||
|
||||
{
|
||||
buildMod = callPackage ./builder.nix {
|
||||
type = "mod";
|
||||
};
|
||||
|
||||
buildSoundPack = callPackage ./builder.nix {
|
||||
type = "soundpack";
|
||||
};
|
||||
|
||||
buildTileSet = callPackage ./builder.nix {
|
||||
type = "tileset";
|
||||
};
|
||||
|
||||
wrapCDDA = callPackage ./wrapper.nix {};
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
--- a/src/translations.cpp
|
||||
+++ b/src/translations.cpp
|
||||
@@ -212,14 +212,12 @@ void set_language()
|
||||
auto env = getenv( "LANGUAGE" );
|
||||
locale_dir = std::string( PATH_INFO::base_path() + "lang/mo/" + ( env ? env : "none" ) +
|
||||
"/LC_MESSAGES/cataclysm-dda.mo" );
|
||||
-#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))
|
||||
+#else
|
||||
if( !PATH_INFO::base_path().empty() ) {
|
||||
locale_dir = PATH_INFO::base_path() + "share/locale";
|
||||
} else {
|
||||
locale_dir = "lang/mo";
|
||||
}
|
||||
-#else
|
||||
- locale_dir = "lang/mo";
|
||||
#endif
|
||||
|
||||
const char *locale_dir_char = locale_dir.c_str();
|
@ -1,20 +0,0 @@
|
||||
diff --git a/src/translations.cpp b/src/translations.cpp
|
||||
index 067e2cd77d..5660d18b3d 100644
|
||||
--- a/src/translations.cpp
|
||||
+++ b/src/translations.cpp
|
||||
@@ -211,14 +211,12 @@ void set_language()
|
||||
auto env = getenv( "LANGUAGE" );
|
||||
locale_dir = std::string( FILENAMES["base_path"] + "lang/mo/" + ( env ? env : "none" ) +
|
||||
"/LC_MESSAGES/cataclysm-dda.mo" );
|
||||
-#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))
|
||||
+#else
|
||||
if( !FILENAMES["base_path"].empty() ) {
|
||||
locale_dir = FILENAMES["base_path"] + "share/locale";
|
||||
} else {
|
||||
locale_dir = "lang/mo";
|
||||
}
|
||||
-#else
|
||||
- locale_dir = "lang/mo";
|
||||
#endif
|
||||
|
||||
const char *locale_dir_char = locale_dir.c_str();
|
27
pkgs/games/cataclysm-dda/pkgs/default.nix
Normal file
27
pkgs/games/cataclysm-dda/pkgs/default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ lib, callPackage, build ? null }:
|
||||
|
||||
let
|
||||
pkgs = {
|
||||
mod = {
|
||||
};
|
||||
|
||||
soundpack = {
|
||||
};
|
||||
|
||||
tileset = {
|
||||
UndeadPeople = callPackage ./tilesets/UndeadPeople {};
|
||||
};
|
||||
};
|
||||
|
||||
pkgs' = lib.mapAttrs (_: mod: lib.filterAttrs availableForBuild mod) pkgs;
|
||||
|
||||
availableForBuild = _: mod:
|
||||
if isNull build then
|
||||
true
|
||||
else if build.isTiles then
|
||||
mod.forTiles
|
||||
else
|
||||
mod.forCurses;
|
||||
in
|
||||
|
||||
lib.makeExtensible (_: pkgs')
|
@ -0,0 +1,23 @@
|
||||
{ lib, buildTileSet, fetchFromGitHub }:
|
||||
|
||||
buildTileSet {
|
||||
modName = "UndeadPeople";
|
||||
version = "2020-07-08";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "SomeDeadGuy";
|
||||
repo = "UndeadPeopleTileset";
|
||||
rev = "f7f13b850fafe2261deee051f45d9c611a661534";
|
||||
sha256 = "0r06srjr7rq51jk9yfyxz80nfgb98mkn86cbcjfxpibgbqvcp0zm";
|
||||
};
|
||||
|
||||
modRoot = "MSX++UnDeadPeopleEdition";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Cataclysm DDA tileset based on MSX++ tileset";
|
||||
homepage = "https://github.com/SomeDeadGuy/UndeadPeopleTileset";
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ mnacamura ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
34
pkgs/games/cataclysm-dda/stable.nix
Normal file
34
pkgs/games/cataclysm-dda/stable.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA
|
||||
, tiles ? true, Cocoa
|
||||
, debug ? false
|
||||
, useXdgDir ? false
|
||||
}:
|
||||
|
||||
let
|
||||
common = callPackage ./common.nix {
|
||||
inherit CoreFoundation tiles Cocoa debug useXdgDir;
|
||||
};
|
||||
|
||||
self = common.overrideAttrs (common: rec {
|
||||
version = "0.E-2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "CleverRaven";
|
||||
repo = "Cataclysm-DDA";
|
||||
rev = version;
|
||||
sha256 = "15l6w6lxays7qmsv0ci2ry53asb9an9dh7l7fc13256k085qcg68";
|
||||
};
|
||||
|
||||
passthru = common.passthru // {
|
||||
pkgs = pkgs.override { build = self; };
|
||||
withMods = wrapCDDA self;
|
||||
};
|
||||
|
||||
meta = common.meta // {
|
||||
maintainers = with lib.maintainers;
|
||||
common.meta.maintainers ++ [ skeidel ];
|
||||
};
|
||||
});
|
||||
in
|
||||
|
||||
self
|
47
pkgs/games/cataclysm-dda/wrapper.nix
Normal file
47
pkgs/games/cataclysm-dda/wrapper.nix
Normal file
@ -0,0 +1,47 @@
|
||||
{ lib, symlinkJoin, makeWrapper }:
|
||||
|
||||
unwrapped:
|
||||
|
||||
pkgsSpec:
|
||||
|
||||
let
|
||||
mods = if lib.isFunction pkgsSpec
|
||||
then pkgsSpec unwrapped.pkgs
|
||||
else pkgsSpec;
|
||||
in
|
||||
|
||||
if builtins.length mods == 0
|
||||
then unwrapped
|
||||
else symlinkJoin {
|
||||
name = unwrapped.name + "-with-mods";
|
||||
|
||||
paths = [ unwrapped ] ++ mods;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
if [ -x $out/bin/cataclysm ]; then
|
||||
wrapProgram $out/bin/cataclysm \
|
||||
--add-flags "--datadir $out/share/cataclysm-dda/"
|
||||
fi
|
||||
if [ -x $out/bin/cataclysm-tiles ]; then
|
||||
wrapProgram $out/bin/cataclysm-tiles \
|
||||
--add-flags "--datadir $out/share/cataclysm-dda/"
|
||||
fi
|
||||
|
||||
# Launch the wrapped program
|
||||
replaceProgram() {
|
||||
cp "$1" "''${1}.bk"
|
||||
unlink "$1"
|
||||
mv "''${1}.bk" "$1"
|
||||
sed -i "$1" -e "s,/nix/store/.\+\(/bin/cataclysm-tiles\),$out\1,"
|
||||
}
|
||||
for script in "$out/share/applications/cataclysm-dda.desktop" \
|
||||
"$out/Applications/Cataclysm.app/Contents/MacOS/Cataclysm.sh"
|
||||
do
|
||||
if [ -e "$script" ]; then
|
||||
replaceProgram "$script"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
@ -23924,13 +23924,11 @@ in
|
||||
inherit (darwin.apple_sdk.frameworks) Carbon CoreServices;
|
||||
};
|
||||
|
||||
cataclysm-dda = callPackage ../games/cataclysm-dda {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
|
||||
};
|
||||
cataclysmDDA = callPackage ../games/cataclysm-dda { };
|
||||
|
||||
cataclysm-dda-git = callPackage ../games/cataclysm-dda/git.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
|
||||
};
|
||||
cataclysm-dda = cataclysmDDA.stable.tiles;
|
||||
|
||||
cataclysm-dda-git = cataclysmDDA.git.tiles;
|
||||
|
||||
chessdb = callPackage ../games/chessdb { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user