From df09156e111c2b23d000c1db9840a1f4990021f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=91=B7=F0=9D=92=89=F0=9D=92=8A=F0=9D=92=8D?= =?UTF-8?q?=F0=9D=92=90=F0=9D=92=84=F0=9D=92=82=F0=9D=92=8D=F0=9D=92=9A?= =?UTF-8?q?=F0=9D=92=94=F0=9D=92=95?= Date: Tue, 19 May 2026 18:33:01 -0400 Subject: [PATCH] cataclysm-dda: refactor common.nix --- pkgs/games/cataclysm-dda/common.nix | 70 +++++++++++++---------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/pkgs/games/cataclysm-dda/common.nix b/pkgs/games/cataclysm-dda/common.nix index b6aab0214858..e9270ad40398 100644 --- a/pkgs/games/cataclysm-dda/common.nix +++ b/pkgs/games/cataclysm-dda/common.nix @@ -1,7 +1,6 @@ { lib, stdenv, - runtimeShell, pkg-config, gettext, ncurses, @@ -19,54 +18,32 @@ let inherit (lib) optionals optionalString; +in +stdenv.mkDerivation (finalAttrs: { + pname = "cataclysm-dda"; - commonDeps = [ + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ gettext zlib - ]; - - cursesDeps = commonDeps ++ [ ncurses ]; - - tilesDeps = commonDeps ++ [ + ] + ++ lib.optionals tiles [ SDL2 SDL2_image SDL2_mixer SDL2_ttf libx11 freetype - ]; - - patchDesktopFile = '' - substituteInPlace $out/share/applications/org.cataclysmdda.CataclysmDDA.desktop \ - --replace-fail "Exec=cataclysm-tiles" "Exec=$out/bin/cataclysm-tiles" - ''; - - installMacOSAppLauncher = '' - app=$out/Applications/Cataclysm.app - install -D -m 444 build-data/osx/Info.plist -t $app/Contents - install -D -m 444 build-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 - -stdenv.mkDerivation { - pname = "cataclysm-dda"; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = if tiles then tilesDeps else cursesDeps; + ] + ++ lib.optional (!tiles) ncurses; postPatch = '' patchShebangs lang/compile_mo.sh + substituteInPlace data/fontdata.json \ + --replace-fail 'data/font/' 'font/' ''; - # remove once on O.I/ahead of upstream commit 15b3cb0 env.NIX_CFLAGS_COMPILE = optionalString stdenv.hostPlatform.isDarwin "-Wno-missing-noreturn"; makeFlags = [ @@ -87,9 +64,22 @@ stdenv.mkDerivation { "OSX_MIN=${stdenv.hostPlatform.darwinMinVersion}" ]; - postInstall = optionalString tiles ( - if !stdenv.hostPlatform.isDarwin then patchDesktopFile else installMacOSAppLauncher - ); + postInstall = + optionalString tiles '' + install -Dm644 data/xdg/org.cataclysmdda.CataclysmDDA.svg \ + $out/share/icons/hicolor/scalable/apps/org.cataclysmdda.CataclysmDDA.svg + + install -Dm644 data/xdg/org.cataclysmdda.CataclysmDDA.appdata.xml \ + $out/share/metainfo/org.cataclysmdda.CataclysmDDA.appdata.xml + '' + + optionalString (tiles && stdenv.hostPlatform.isDarwin) '' + app=$out/Applications/Cataclysm.app + + install -Dm444 build-data/osx/Info.plist -t $app/Contents + install -Dm444 build-data/osx/AppIcon.icns -t $app/Contents/Resources + install -Dm555 build-data/osx/Cataclysm.sh $app/Contents/MacOS/Cataclysm.sh + ln -sf $out/bin/cataclysm-tiles $app/Contents/Resources/cataclysm-tiles + ''; dontStrip = debug; enableParallelBuilding = true; @@ -100,7 +90,7 @@ stdenv.mkDerivation { }; meta = { - description = "Free, post apocalyptic, zombie infested rogue-like"; + description = "Free post-apocalyptic zombie-infested roguelike"; mainProgram = "cataclysm-tiles"; longDescription = '' Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world. @@ -133,4 +123,4 @@ stdenv.mkDerivation { ]; platforms = lib.platforms.unix; }; -} +})