From 3199d631af2cdbec5bfd90d863c25ced722d03ba Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 24 Mar 2024 11:08:30 -0300 Subject: [PATCH 1/3] _86Box: rewrite derivation in finalAttrs form Signed-off-by: lucasew --- pkgs/applications/emulators/86box/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/emulators/86box/default.nix b/pkgs/applications/emulators/86box/default.nix index 1fceee8182ed..43b5dfae541e 100644 --- a/pkgs/applications/emulators/86box/default.nix +++ b/pkgs/applications/emulators/86box/default.nix @@ -8,14 +8,14 @@ , unfreeEnableDiscord ? false }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "86Box"; version = "4.1"; src = fetchFromGitHub { owner = "86Box"; repo = "86Box"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-JYOJFXiUTLRs6AEMYNx88PwcVw13ChQzV1ZE5OtX6Ds="; }; @@ -82,4 +82,4 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.jchw ]; platforms = platforms.linux; }; -} +}) From cae20d2bf589c4e7a76e5dc863ee45dc03a60b91 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 24 Mar 2024 11:12:18 -0300 Subject: [PATCH 2/3] _86Box: simplify wrapping logic Signed-off-by: lucasew --- pkgs/applications/emulators/86box/default.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/emulators/86box/default.nix b/pkgs/applications/emulators/86box/default.nix index 43b5dfae541e..d1a414fc0792 100644 --- a/pkgs/applications/emulators/86box/default.nix +++ b/pkgs/applications/emulators/86box/default.nix @@ -59,21 +59,15 @@ stdenv.mkDerivation (finalAttrs: { # Some libraries are loaded dynamically, but QLibrary doesn't seem to search # the runpath, so use a wrapper instead. - postFixup = let + preFixup = let libPath = lib.makeLibraryPath ([ libpcap ] ++ lib.optional unfreeEnableDiscord discord-gamesdk); libPathVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; - in - '' - wrapProgram $out/bin/86Box \ - "''${qtWrapperArgs[@]}" \ - --prefix ${libPathVar} : "${libPath}" + in '' + makeWrapperArgs+=(--prefix ${libPathVar} : "${libPath}") ''; - # Do not wrap twice. - dontWrapQtApps = true; - meta = with lib; { description = "Emulator of x86-based machines based on PCem."; mainProgram = "86Box"; From f27f538533135d0ec6cb49fc5613c250bbb96b9a Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 24 Mar 2024 11:13:47 -0300 Subject: [PATCH 3/3] _86Box: add support for unfree roms as _86Box-with-roms Signed-off-by: lucasew --- pkgs/applications/emulators/86box/default.nix | 19 +++++++++++++++++-- pkgs/top-level/all-packages.nix | 5 +++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/emulators/86box/default.nix b/pkgs/applications/emulators/86box/default.nix index d1a414fc0792..4e2cb8541205 100644 --- a/pkgs/applications/emulators/86box/default.nix +++ b/pkgs/applications/emulators/86box/default.nix @@ -6,6 +6,7 @@ , enableNewDynarec ? enableDynarec && stdenv.hostPlatform.isAarch , enableVncRenderer ? false , unfreeEnableDiscord ? false +, unfreeEnableRoms ? false }: stdenv.mkDerivation (finalAttrs: { @@ -48,15 +49,28 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optional (!enableDynarec) "-DDYNAREC=OFF" ++ lib.optional (!unfreeEnableDiscord) "-DDISCORD=OFF"; - postInstall = lib.optional stdenv.isLinux '' + postInstall = lib.optionalString stdenv.isLinux '' install -Dm644 -t $out/share/applications $src/src/unix/assets/net.86box.86Box.desktop for size in 48 64 72 96 128 192 256 512; do install -Dm644 -t $out/share/icons/hicolor/"$size"x"$size"/apps \ $src/src/unix/assets/"$size"x"$size"/net.86box.86Box.png done; + '' + + lib.optionalString unfreeEnableRoms '' + mkdir -p $out/share/86Box + ln -s ${finalAttrs.passthru.roms} $out/share/86Box/roms ''; + passthru = { + roms = fetchFromGitHub { + owner = "86Box"; + repo = "roms"; + rev = "v${finalAttrs.version}"; + hash = "sha256-1HtoizO0QIGNjQTW0clzRp40h1ulw55+iTYz12UJSms="; + }; + }; + # Some libraries are loaded dynamically, but QLibrary doesn't seem to search # the runpath, so use a wrapper instead. preFixup = let @@ -72,7 +86,8 @@ stdenv.mkDerivation (finalAttrs: { description = "Emulator of x86-based machines based on PCem."; mainProgram = "86Box"; homepage = "https://86box.net/"; - license = with licenses; [ gpl2Only ] ++ optional unfreeEnableDiscord unfree; + license = with licenses; [ gpl2Only ] + ++ optional (unfreeEnableDiscord || unfreeEnableRoms) unfree; maintainers = [ maintainers.jchw ]; platforms = platforms.linux; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8fbc09e2afac..4b37dc0208c3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2620,6 +2620,11 @@ with pkgs; _86Box = callPackage ../applications/emulators/86box { }; + _86Box-with-roms = _86Box.override { + unfreeEnableRoms = true; + unfreeEnableDiscord = true; + }; + attract-mode = callPackage ../applications/emulators/attract-mode { }; basiliskii = callPackage ../applications/emulators/basiliskii { };