mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-28 16:10:17 +02:00
commanderx16: create x16-run script
In a typical FHS-compliant system, the rom and the emulator share the same directory tree, and x16emu explores it. But Nix/Nixpkgs breaks this assumption. Therefore, I made a useful script tailored to a regular user of Nixpkgs invoke it in a more straightforward way. With this, the end user does not need to explicitly set the default rom path.
This commit is contained in:
parent
43362bd872
commit
37916df9d0
39
pkgs/misc/emulators/commander-x16/run.nix
Normal file
39
pkgs/misc/emulators/commander-x16/run.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, runtimeShell
|
||||
, symlinkJoin
|
||||
, writeTextFile
|
||||
}:
|
||||
|
||||
{ emulator, rom }:
|
||||
|
||||
assert emulator.version == rom.version;
|
||||
|
||||
let
|
||||
runScript = writeTextFile {
|
||||
name = "run-x16";
|
||||
text = ''
|
||||
#!${runtimeShell}
|
||||
|
||||
defaultRom="${rom}/share/x16-rom/rom.bin"
|
||||
|
||||
exec "${emulator}/bin/x16emu" -rom $defaultRom "$@"
|
||||
'';
|
||||
executable = true;
|
||||
destination = "/bin/run-x16";
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "run-x16-${emulator.version}";
|
||||
|
||||
paths = [
|
||||
emulator
|
||||
rom
|
||||
runScript
|
||||
];
|
||||
}
|
||||
# TODO [ AndersonTorres ]:
|
||||
|
||||
# 1. Parse the command line in order to allow the user to set an optional
|
||||
# rom-file
|
||||
# 2. generate runScript based on symlinkJoin (maybe a postBuild?)
|
|
@ -31617,6 +31617,10 @@ in
|
|||
|
||||
x16-emulator = callPackage ../misc/emulators/commander-x16/emulator.nix { };
|
||||
x16-rom = callPackage ../misc/emulators/commander-x16/rom.nix { };
|
||||
x16-run = (callPackage ../misc/emulators/commander-x16/run.nix { }) {
|
||||
emulator = x16-emulator;
|
||||
rom = x16-rom;
|
||||
};
|
||||
|
||||
bullet = callPackage ../development/libraries/bullet {
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL;
|
||||
|
|
Loading…
Reference in a new issue