Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallout-ce: init at 1.0.0 #239450

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions pkgs/games/fallout-ce/build.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{ cmake
, fpattern
, lib
, SDL2
, stdenv
, writeShellScript

, extraBuildInputs ? [ ]
, extraMeta
, pname
, version
, src
}:

let
launcher = writeShellScript "${pname}" ''
set -eu
assetDir="''${XDG_DATA_HOME:-$HOME/.local/share}/${pname}"
[ -d "$assetDir" ] || mkdir -p "$assetDir"
cd "$assetDir"

notice=0 fault=0
requiredFiles=(master.dat critter.dat)
for f in "''${requiredFiles[@]}"; do
if [ ! -f "$f" ]; then
echo "Required file $f not found in $PWD, note the files are case-sensitive"
notice=1 fault=1
fi
done

if [ ! -d "data/sound/music" ]; then
echo "data/sound/music directory not found in $PWD. This may prevent in-game music from functioning."
notice=1
fi

if [ $notice -ne 0 ]; then
echo "Please reference the installation instructions at https://github.com/alexbatalov/fallout2-ce"
fi

if [ $fault -ne 0 ]; then
exit $fault;
fi

exec @out@/libexec/${pname} "$@"
'';
in
stdenv.mkDerivation {
inherit pname version src;

nativeBuildInputs = [ cmake ];
buildInputs = [ SDL2 ] ++ extraBuildInputs;
hardeningDisable = [ "format" ];
cmakeBuildType = "RelWithDebInfo";

postPatch = ''
substituteInPlace third_party/fpattern/CMakeLists.txt \
--replace "FetchContent_Populate" "#FetchContent_Populate" \
--replace "{fpattern_SOURCE_DIR}" "${fpattern}/include" \
--replace "$/nix/" "/nix/"
'';

installPhase = ''
runHook preInstall

install -D ${pname} $out/libexec/${pname}
install -D ${launcher} $out/bin/${pname}
substituteInPlace $out/bin/${pname} --subst-var out

runHook postInstall
'';

meta = with lib; {
license = licenses.sustainableUse;
maintainers = with maintainers; [ hughobrien TheBrainScrambler ];
platforms = platforms.linux;
} // extraMeta;
}
20 changes: 20 additions & 0 deletions pkgs/games/fallout-ce/fallout-ce.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ callPackage
, fetchFromGitHub
}:

callPackage ./build.nix rec {
pname = "fallout-ce";
version = "1.0.0";

src = fetchFromGitHub {
owner = "alexbatalov";
repo = "fallout1-ce";
rev = "v${version}";
hash = "sha256-EvRkOlvtiVao63S0WRKKuHlhfkdTgc0m6GTyv4EfJFU=";
};

extraMeta = {
description = "A fully working re-implementation of Fallout, with the same original gameplay, engine bugfixes, and some quality of life improvements";
homepage = "https://github.com/alexbatalov/fallout1-ce";
};
}
23 changes: 23 additions & 0 deletions pkgs/games/fallout-ce/fallout2-ce.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ callPackage
, fetchFromGitHub
, zlib
}:

callPackage ./build.nix rec {
pname = "fallout2-ce";
version = "1.2.0";

src = fetchFromGitHub {
owner = "alexbatalov";
repo = "fallout2-ce";
rev = "v${version}";
hash = "sha256-+N4jhmxBX6z48kaU0jm90OKhguHlggT3OF9uuyY0EV0=";
};

extraBuildInputs = [ zlib ];

extraMeta = {
description = "A fully working re-implementation of Fallout 2, with the same original gameplay, engine bugfixes, and some quality of life improvements";
homepage = "https://github.com/alexbatalov/fallout2-ce";
};
}
3 changes: 3 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37522,6 +37522,9 @@ with pkgs;

exult = callPackage ../games/exult { };

fallout-ce = callPackage ../games/fallout-ce/fallout-ce.nix { };
fallout2-ce = callPackage ../games/fallout-ce/fallout2-ce.nix { };

flare = callPackage ../games/flare {
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
Expand Down