From a6915dbedb2b14cfb08c401b07ca623fe08ce0a5 Mon Sep 17 00:00:00 2001 From: amusingimpala75 <69653100+amusingimpala75@users.noreply.github.com> Date: Mon, 18 Aug 2025 11:25:35 -0700 Subject: [PATCH] brogue-ce: add configuration options for terminal/graphics and macOS Exposes configuration options 'terminal' and 'graphics', with defaults (false, true respectively) to match existing behaviour Moves SDL2 deps behind the 'graphics' flag and adds ncurses dep behind 'terminal' flag. The respective make flags are applied to build for terminal/graphics. In addition, brogue-ce is bundled into a macOS application when on darwin and graphics are enabled. --- pkgs/by-name/br/brogue-ce/package.nix | 31 +++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/br/brogue-ce/package.nix b/pkgs/by-name/br/brogue-ce/package.nix index 72e06aab80be..fe1040e2b634 100644 --- a/pkgs/by-name/br/brogue-ce/package.nix +++ b/pkgs/by-name/br/brogue-ce/package.nix @@ -4,8 +4,13 @@ fetchFromGitHub, makeDesktopItem, copyDesktopItems, + + ncurses, SDL2, SDL2_image, + + terminal ? false, + graphics ? true, }: stdenv.mkDerivation (finalAttrs: { @@ -28,12 +33,25 @@ stdenv.mkDerivation (finalAttrs: { copyDesktopItems ]; - buildInputs = [ - SDL2 - SDL2_image + buildInputs = + (lib.optionals graphics [ + SDL2 + SDL2_image + ]) + ++ (lib.optionals terminal [ + ncurses + ]); + + makeFlags = [ + "DATADIR=$(out)/opt/brogue-ce" + "TERMINAL=${if terminal then "YES" else "NO"}" + "GRAPHICS=${if graphics then "YES" else "NO"}" + "MAC_APP=${if stdenv.isDarwin then "YES" else "NO"}" ]; - makeFlags = [ "DATADIR=$(out)/opt/brogue-ce" ]; + postBuild = lib.optionalString (stdenv.isDarwin && graphics) '' + make Brogue.app $makeFlags + ''; desktopItems = [ (makeDesktopItem { @@ -59,6 +77,11 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; + postInstall = lib.optionalString (stdenv.isDarwin && graphics) '' + mkdir -p $out/Applications + mv Brogue.app "$out/Applications/Brogue CE.app" + ''; + meta = with lib; { description = "Community-lead fork of the minimalist roguelike game Brogue"; mainProgram = "brogue-ce";