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 /pkgs/misc/emulators/commander-x16/run.nix | |
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.
Diffstat (limited to 'pkgs/misc/emulators/commander-x16/run.nix')
-rw-r--r-- | pkgs/misc/emulators/commander-x16/run.nix | 39 |
1 files changed, 39 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?) |