commit
f061413686
@ -443,6 +443,7 @@
|
|||||||
./services/misc/logkeys.nix
|
./services/misc/logkeys.nix
|
||||||
./services/misc/leaps.nix
|
./services/misc/leaps.nix
|
||||||
./services/misc/lidarr.nix
|
./services/misc/lidarr.nix
|
||||||
|
./services/misc/mame.nix
|
||||||
./services/misc/mathics.nix
|
./services/misc/mathics.nix
|
||||||
./services/misc/matrix-synapse.nix
|
./services/misc/matrix-synapse.nix
|
||||||
./services/misc/mbpfan.nix
|
./services/misc/mbpfan.nix
|
||||||
|
67
nixos/modules/services/misc/mame.nix
Normal file
67
nixos/modules/services/misc/mame.nix
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.mame;
|
||||||
|
mame = "mame${lib.optionalString pkgs.stdenv.is64bit "64"}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.mame = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to setup TUN/TAP Ethernet interface for MAME emulator.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
User from which you run MAME binary.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
hostAddr = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
IP address of the host system. Usually an address of the main network
|
||||||
|
adapter or the adapter through which you get an internet connection.
|
||||||
|
'';
|
||||||
|
example = "192.168.31.156";
|
||||||
|
};
|
||||||
|
emuAddr = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
IP address of the guest system. The same you set inside guest OS under
|
||||||
|
MAME. Should be on the same subnet as <option>services.mame.hostAddr</option>.
|
||||||
|
'';
|
||||||
|
example = "192.168.31.155";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.mame ];
|
||||||
|
|
||||||
|
security.wrappers."${mame}" = {
|
||||||
|
source = "${pkgs.mame}/bin/${mame}";
|
||||||
|
capabilities = "cap_net_admin,cap_net_raw+eip";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.mame = {
|
||||||
|
description = "MAME TUN/TAP Ethernet interface";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = [ pkgs.iproute ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${pkgs.mame}/bin/taputil.sh -c ${cfg.user} ${cfg.emuAddr} ${cfg.hostAddr} -";
|
||||||
|
ExecStop = "${pkgs.mame}/bin/taputil.sh -d ${cfg.user}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ gnidorah ];
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
{ stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem
|
{ stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem, makeWrapper
|
||||||
, python, pkgconfig, SDL2, SDL2_ttf, alsaLib, which, qtbase, libXinerama }:
|
, python, pkgconfig, SDL2, SDL2_ttf, alsaLib, which, qtbase, libXinerama }:
|
||||||
|
|
||||||
let
|
let
|
||||||
majorVersion = "0";
|
majorVersion = "0";
|
||||||
minorVersion = "215";
|
minorVersion = "216";
|
||||||
|
|
||||||
desktopItem = makeDesktopItem {
|
desktopItem = makeDesktopItem {
|
||||||
name = "MAME";
|
name = "MAME";
|
||||||
@ -12,6 +12,8 @@ let
|
|||||||
genericName = "MAME is a multi-purpose emulation framework";
|
genericName = "MAME is a multi-purpose emulation framework";
|
||||||
categories = "System;Emulator;";
|
categories = "System;Emulator;";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dest = "$out/opt/mame";
|
||||||
in mkDerivation {
|
in mkDerivation {
|
||||||
pname = "mame";
|
pname = "mame";
|
||||||
version = "${majorVersion}.${minorVersion}";
|
version = "${majorVersion}.${minorVersion}";
|
||||||
@ -20,7 +22,7 @@ in mkDerivation {
|
|||||||
owner = "mamedev";
|
owner = "mamedev";
|
||||||
repo = "mame";
|
repo = "mame";
|
||||||
rev = "mame${majorVersion}${minorVersion}";
|
rev = "mame${majorVersion}${minorVersion}";
|
||||||
sha256 = "1phz846p3zzgzrbfiq2vn79iqar2dbf7iv6wfkrp32sdkkvp7l3h";
|
sha256 = "0dmmw08pxxznvadrc51zg27jc9fjh688355w8kxkmi7k8qa367r0";
|
||||||
};
|
};
|
||||||
|
|
||||||
hardeningDisable = [ "fortify" ];
|
hardeningDisable = [ "fortify" ];
|
||||||
@ -28,22 +30,35 @@ in mkDerivation {
|
|||||||
|
|
||||||
makeFlags = [ "TOOLS=1" ];
|
makeFlags = [ "TOOLS=1" ];
|
||||||
|
|
||||||
|
dontWrapQtApps = true;
|
||||||
|
|
||||||
buildInputs = [ SDL2 SDL2_ttf alsaLib qtbase libXinerama ];
|
buildInputs = [ SDL2 SDL2_ttf alsaLib qtbase libXinerama ];
|
||||||
nativeBuildInputs = [ python pkgconfig which ];
|
nativeBuildInputs = [ python pkgconfig which makeWrapper ];
|
||||||
|
|
||||||
|
# by default MAME assumes that paths with stock resources
|
||||||
|
# are relative and that you run MAME changing to
|
||||||
|
# install directory, so we add absolute paths here
|
||||||
|
patches = [ ./emuopts.patch ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace src/emu/emuopts.cpp \
|
||||||
|
--subst-var-by mame ${dest}
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
dest=$out/opt/mame
|
make -f dist.mak PTR64=${stdenv.lib.optionalString stdenv.is64bit "1"}
|
||||||
|
mkdir -p ${dest}
|
||||||
make -f dist.mak PTR64=${if stdenv.is64bit then "1" else "0"}
|
mv build/release/*/Release/mame/* ${dest}
|
||||||
mkdir -p $dest
|
|
||||||
mv build/release/${if stdenv.is64bit then "x64" else "x32"}/Release/mame/* $dest
|
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
find $dest -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
|
find ${dest} -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
|
||||||
|
install -Dm755 src/osd/sdl/taputil.sh $out/bin/taputil.sh
|
||||||
|
|
||||||
mkdir -p $out/share/man/man{1,6}
|
mkdir -p $out/share/man/man{1,6}
|
||||||
mv $dest/docs/man/*.1 $out/share/man/man1
|
mv ${dest}/docs/man/*.1 $out/share/man/man1
|
||||||
mv $dest/docs/man/*.6 $out/share/man/man6
|
mv ${dest}/docs/man/*.6 $out/share/man/man6
|
||||||
|
|
||||||
|
mv artwork plugins samples ${dest}
|
||||||
|
|
||||||
mkdir -p $out/share
|
mkdir -p $out/share
|
||||||
ln -s ${desktopItem}/share/applications $out/share
|
ln -s ${desktopItem}/share/applications $out/share
|
||||||
|
29
pkgs/misc/emulators/mame/emuopts.patch
Normal file
29
pkgs/misc/emulators/mame/emuopts.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
|
||||||
|
index c42fcef848..d1bddae060 100644
|
||||||
|
--- a/src/emu/emuopts.cpp
|
||||||
|
+++ b/src/emu/emuopts.cpp
|
||||||
|
@@ -36,16 +36,16 @@ const options_entry emu_options::s_option_entries[] =
|
||||||
|
{ nullptr, nullptr, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" },
|
||||||
|
{ OPTION_HOMEPATH, ".", OPTION_STRING, "path to base folder for plugin data (read/write)" },
|
||||||
|
{ OPTION_MEDIAPATH ";rp;biospath;bp", "roms", OPTION_STRING, "path to ROM sets and hard disk images" },
|
||||||
|
- { OPTION_HASHPATH ";hash_directory;hash", "hash", OPTION_STRING, "path to software definition files" },
|
||||||
|
- { OPTION_SAMPLEPATH ";sp", "samples", OPTION_STRING, "path to audio sample sets" },
|
||||||
|
- { OPTION_ARTPATH, "artwork", OPTION_STRING, "path to artwork files" },
|
||||||
|
- { OPTION_CTRLRPATH, "ctrlr", OPTION_STRING, "path to controller definitions" },
|
||||||
|
- { OPTION_INIPATH, ".;ini;ini/presets", OPTION_STRING, "path to ini files" },
|
||||||
|
- { OPTION_FONTPATH, ".", OPTION_STRING, "path to font files" },
|
||||||
|
+ { OPTION_HASHPATH ";hash_directory;hash", "hash;@mame@/hash", OPTION_STRING, "path to software definition files" },
|
||||||
|
+ { OPTION_SAMPLEPATH ";sp", "samples;@mame@/samples", OPTION_STRING, "path to audio sample sets" },
|
||||||
|
+ { OPTION_ARTPATH, "artwork;@mame@/artwork", OPTION_STRING, "path to artwork files" },
|
||||||
|
+ { OPTION_CTRLRPATH, "ctrlr;@mame@/ctrlr", OPTION_STRING, "path to controller definitions" },
|
||||||
|
+ { OPTION_INIPATH, ".;ini;ini/presets;@mame@/ini/presets", OPTION_STRING, "path to ini files" },
|
||||||
|
+ { OPTION_FONTPATH, ".;@mame@", OPTION_STRING, "path to font files" },
|
||||||
|
{ OPTION_CHEATPATH, "cheat", OPTION_STRING, "path to cheat files" },
|
||||||
|
{ OPTION_CROSSHAIRPATH, "crosshair", OPTION_STRING, "path to crosshair files" },
|
||||||
|
- { OPTION_PLUGINSPATH, "plugins", OPTION_STRING, "path to plugin files" },
|
||||||
|
- { OPTION_LANGUAGEPATH, "language", OPTION_STRING, "path to UI translation files" },
|
||||||
|
+ { OPTION_PLUGINSPATH, "plugins;@mame@/plugins", OPTION_STRING, "path to plugin files" },
|
||||||
|
+ { OPTION_LANGUAGEPATH, "language;@mame@/language", OPTION_STRING, "path to UI translation files" },
|
||||||
|
{ OPTION_SWPATH, "software", OPTION_STRING, "path to loose software" },
|
||||||
|
|
||||||
|
// output directory options
|
Loading…
x
Reference in New Issue
Block a user