diff options
author | AndersonTorres <torres.anderson.85@protonmail.com> | 2021-06-16 15:25:28 -0300 |
---|---|---|
committer | AndersonTorres <torres.anderson.85@protonmail.com> | 2021-06-16 22:41:13 -0300 |
commit | 37916df9d0e23a4408e823ad45bb96b2f0424ca4 (patch) | |
tree | daacb8ee042a78210ade9204dadacf5975bde221 | |
parent | 43362bd872ee56f7c3c391e84d7bfaf900de7f93 (diff) | |
download | nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar.gz nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar.bz2 nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar.lz nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar.xz nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.tar.zst nixpkgs-37916df9d0e23a4408e823ad45bb96b2f0424ca4.zip |
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.
-rw-r--r-- | pkgs/misc/emulators/commander-x16/run.nix | 39 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
2 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/misc/emulators/commander-x16/run.nix b/pkgs/misc/emulators/commander-x16/run.nix new file mode 100644 index 00000000000..cf14252b487 --- /dev/null +++ b/pkgs/misc/emulators/commander-x16/run.nix @@ -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?) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2cb0404e139..07ec28f70e8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; |