x16: adopt & modernize

This commit is contained in:
Leah Amelia Chen 2025-05-18 13:07:55 +02:00
parent b1a81b82aa
commit 0405671c7b
No known key found for this signature in database
3 changed files with 15 additions and 18 deletions

View file

@ -6,6 +6,7 @@
SDL2, SDL2,
callPackage, callPackage,
zlib, zlib,
nix-update-script,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -15,7 +16,7 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "X16Community"; owner = "X16Community";
repo = "x16-emulator"; repo = "x16-emulator";
rev = "r${finalAttrs.version}"; tag = "r${finalAttrs.version}";
hash = "sha256-E4TosRoORCWLotOIXROP9oqwqo1IRSa6X13GnmuxE9A="; hash = "sha256-E4TosRoORCWLotOIXROP9oqwqo1IRSa6X13GnmuxE9A=";
}; };
@ -58,14 +59,16 @@ stdenv.mkDerivation (finalAttrs: {
run = (callPackage ./run.nix { }) { run = (callPackage ./run.nix { }) {
inherit (finalAttrs.finalPackage) emulator rom; inherit (finalAttrs.finalPackage) emulator rom;
}; };
updateScript = nix-update-script { };
}; };
meta = { meta = {
homepage = "https://cx16forum.com/"; homepage = "https://cx16forum.com/";
description = "Official emulator of CommanderX16 8-bit computer"; description = "Official emulator of CommanderX16 8-bit computer";
changelog = "https://github.com/X16Community/x16-emulator/blob/r${finalAttrs.version}/RELEASES.md"; changelog = "https://github.com/X16Community/x16-emulator/blob/${finalAttrs.src.rev}/RELEASES.md";
license = lib.licenses.bsd2; license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ ]; maintainers = with lib.maintainers; [ pluiedev ];
mainProgram = "x16emu"; mainProgram = "x16emu";
inherit (SDL2.meta) platforms; inherit (SDL2.meta) platforms;
broken = stdenv.hostPlatform.isAarch64; # ofborg fails to compile it broken = stdenv.hostPlatform.isAarch64; # ofborg fails to compile it

View file

@ -5,6 +5,7 @@
cc65, cc65,
lzsa, lzsa,
python3, python3,
nix-update-script,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -27,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = '' postPatch = ''
patchShebangs findsymbols scripts/ patchShebangs findsymbols scripts/
substituteInPlace Makefile \ substituteInPlace Makefile \
--replace-fail '/bin/echo' 'echo' --replace-fail '/bin/echo' 'echo'
''; '';
dontConfigure = true; dontConfigure = true;
@ -47,13 +48,14 @@ stdenv.mkDerivation (finalAttrs: {
# upstream project recommends emulator and rom to be synchronized; passing # upstream project recommends emulator and rom to be synchronized; passing
# through the version is useful to ensure this # through the version is useful to ensure this
inherit (finalAttrs) version; inherit (finalAttrs) version;
updateScript = nix-update-script { };
}; };
meta = { meta = {
homepage = "https://github.com/X16Community/x16-rom"; homepage = "https://github.com/X16Community/x16-rom";
description = "ROM file for CommanderX16 8-bit computer"; description = "ROM file for CommanderX16 8-bit computer";
license = lib.licenses.bsd2; license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ ]; maintainers = with lib.maintainers; [ pluiedev ];
inherit (cc65.meta) platforms; inherit (cc65.meta) platforms;
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
}; };

View file

@ -1,7 +1,7 @@
{ {
runtimeShell, runtimeShell,
symlinkJoin, symlinkJoin,
writeTextFile, writeShellScriptBin,
}: }:
{ emulator, rom }: { emulator, rom }:
@ -9,18 +9,10 @@
assert emulator.version == rom.version; assert emulator.version == rom.version;
let let
runScript = writeTextFile { runScript = writeShellScriptBin "run-x16" ''
name = "run-x16"; defaultRom="${rom}/share/x16-rom/rom.bin"
text = '' exec "${emulator}/bin/x16emu" -rom $defaultRom "$@"
#!${runtimeShell} '';
defaultRom="${rom}/share/x16-rom/rom.bin"
exec "${emulator}/bin/x16emu" -rom $defaultRom "$@"
'';
executable = true;
destination = "/bin/run-x16";
};
in in
symlinkJoin { symlinkJoin {
pname = "run-x16"; pname = "run-x16";