From 6ec3610cd8926d89c42ce657c00425e5872d8855 Mon Sep 17 00:00:00 2001 From: Anderson Torres <torres.anderson.85@protonmail.com> Date: Sat, 12 Aug 2023 23:24:28 -0300 Subject: [PATCH] uxn: refactor - use finalAttrs pattern - split projects into its own output - set strictDeps to true - set meta.mainProgram to uxnemu --- pkgs/applications/emulators/uxn/default.nix | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/emulators/uxn/default.nix b/pkgs/applications/emulators/uxn/default.nix index 85a3a541f963..66df76e1bac0 100644 --- a/pkgs/applications/emulators/uxn/default.nix +++ b/pkgs/applications/emulators/uxn/default.nix @@ -5,7 +5,7 @@ , unstableGitUpdater }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "uxn"; version = "unstable-2023-08-10"; @@ -16,12 +16,23 @@ stdenv.mkDerivation { hash = "sha256-3Q8460pkoATKCEqfa+OfpQ4Lp18Ro5i84s88pkz+uzU="; }; + outputs = [ "out" "projects" ]; + + nativeBuildInputs = [ + SDL2 + ]; + buildInputs = [ SDL2 ]; + strictDeps = true; + postPatch = '' - sed -i -e 's|UXNEMU_LDFLAGS="$(brew.*$|UXNEMU_LDFLAGS="$(sdl2-config --cflags --libs)"|' build.sh + patchShebangs build.sh + substituteInPlace build.sh \ + --replace "-L/usr/local/lib " "" \ + --replace "\$(brew --prefix)/lib/libSDL2.a " "" ''; buildPhase = '' @@ -32,13 +43,15 @@ stdenv.mkDerivation { runHook postBuild ''; + # ./build.sh --install is meant to install in $HOME, therefore not useful for + # package maintainers installPhase = '' runHook preInstall - install -d $out/bin/ $out/share/uxn/ - + install -d $out/bin/ cp bin/uxnasm bin/uxncli bin/uxnemu $out/bin/ - cp -r projects $out/share/uxn/ + install -d $projects/share/uxn/ + cp -r projects $projects/share/uxn/ runHook postInstall ''; @@ -49,7 +62,8 @@ stdenv.mkDerivation { homepage = "https://wiki.xxiivv.com/site/uxn.html"; description = "An assembler and emulator for the Uxn stack machine"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ AndersonTorres kototama ]; + maintainers = with lib.maintainers; [ AndersonTorres ]; + mainProgram = "uxnemu"; inherit (SDL2.meta) platforms; }; -} +})