diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-10-20 22:09:03 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-10-20 22:09:03 +0000 |
commit | 50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e (patch) | |
tree | f2556b911180125ccbb7ed0e78a54e92da89adce /nixpkgs/pkgs/games/fallout-ce/build.nix | |
parent | 4c16d4548a98563c9d9ad76f4e5b2202864ccd54 (diff) | |
parent | cfc75eec4603c06503ae750f88cf397e00796ea8 (diff) | |
download | nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.gz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.bz2 nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.lz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.xz nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.zst nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.zip |
Merge commit 'cfc75eec4603c06503ae750f88cf397e00796ea8'
Conflicts: nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/games/fallout-ce/build.nix')
-rw-r--r-- | nixpkgs/pkgs/games/fallout-ce/build.nix | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/fallout-ce/build.nix b/nixpkgs/pkgs/games/fallout-ce/build.nix new file mode 100644 index 000000000000..c220895db08c --- /dev/null +++ b/nixpkgs/pkgs/games/fallout-ce/build.nix @@ -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; +} |