about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/emulators/commanderx16/run.nix
blob: 1f14fdb223c71d4bf6c598ea6461cb4b6b381693 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ 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?)