1 { config, lib, pkgs, ... }:
6 cfg = config.services.mame;
7 mame = "mame${lib.optionalString pkgs.stdenv.is64bit "64"}";
15 description = lib.mdDoc ''
16 Whether to setup TUN/TAP Ethernet interface for MAME emulator.
21 description = lib.mdDoc ''
22 User from which you run MAME binary.
27 description = lib.mdDoc ''
28 IP address of the host system. Usually an address of the main network
29 adapter or the adapter through which you get an internet connection.
31 example = "192.168.31.156";
35 description = lib.mdDoc ''
36 IP address of the guest system. The same you set inside guest OS under
37 MAME. Should be on the same subnet as {option}`services.mame.hostAddr`.
39 example = "192.168.31.155";
44 config = mkIf cfg.enable {
45 environment.systemPackages = [ pkgs.mame ];
47 security.wrappers."${mame}" = {
50 capabilities = "cap_net_admin,cap_net_raw+eip";
51 source = "${pkgs.mame}/bin/${mame}";
54 systemd.services.mame = {
55 description = "MAME TUN/TAP Ethernet interface";
56 after = [ "network.target" ];
57 wantedBy = [ "multi-user.target" ];
58 path = [ pkgs.iproute2 ];
61 RemainAfterExit = true;
62 ExecStart = "${pkgs.mame}/bin/taputil.sh -c ${cfg.user} ${cfg.emuAddr} ${cfg.hostAddr} -";
63 ExecStop = "${pkgs.mame}/bin/taputil.sh -d ${cfg.user}";
68 meta.maintainers = with lib.maintainers; [ ];