about summary refs log tree commit diff
path: root/pkgs/by-name/x1/x16/run.nix
blob: 274e98afecca5d70e34b13d19ce7e63f3243880b (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
38
{ 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?)
# 3. a NixOS module to abstract the runner