diff --git a/pkgs/by-name/fa/fallout-ce/build.nix b/pkgs/by-name/fa/fallout-ce/build.nix deleted file mode 100644 index 4d1de515ac5a..000000000000 --- a/pkgs/by-name/fa/fallout-ce/build.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ - cmake, - fpattern, - lib, - SDL2, - stdenv, - writeShellScript, - - extraBuildInputs ? [ ], - extraMeta, - patches, - 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 - patches - ; - - 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 - iedame - ]; - platforms = platforms.linux; - } - // extraMeta; -} diff --git a/pkgs/by-name/fa/fallout-ce/package.nix b/pkgs/by-name/fa/fallout-ce/package.nix index 6754fad6a1b5..01fab73d094d 100644 --- a/pkgs/by-name/fa/fallout-ce/package.nix +++ b/pkgs/by-name/fa/fallout-ce/package.nix @@ -1,10 +1,48 @@ { - callPackage, + cmake, fetchFromGitHub, fetchpatch2, + fpattern, + lib, + SDL2, + stdenv, + writeShellScript, }: -callPackage ./build.nix rec { +let + launcher = writeShellScript "fallout-ce" '' + set -eu + assetDir="''${XDG_DATA_HOME:-$HOME/.local/share}/fallout-ce" + [ -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/fallout1-ce" + fi + + if [ $fault -ne 0 ]; then + exit $fault; + fi + + exec @out@/libexec/fallout-ce "$@" + ''; +in + +stdenv.mkDerivation rec { pname = "fallout-ce"; version = "1.1.0"; @@ -23,8 +61,39 @@ callPackage ./build.nix rec { }) ]; - extraMeta = { - description = "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"; - }; + nativeBuildInputs = [ cmake ]; + buildInputs = [ SDL2 ]; + 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; + description = "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"; + maintainers = with maintainers; [ + hughobrien + iedame + ]; + platforms = platforms.linux; + }; } +