git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #74722 from gnidorah/mame

mame: 0.215 -> 0.216

commitf0614136865677d50720fd3820e9ac5689b7c637 authorLassulus <github@lassul.us> dateTue 17 Dec 2019, 07:57 (7 years ago) parent67d1525cc54e5a
4 files changed+124−12
nixos/modules/module-list.nix+1 nixos/modules/services/misc/mame.nix+67 pkgs/misc/emulators/mame/default.nix+27−12 pkgs/misc/emulators/mame/emuopts.patch+29
nixos/modules/module-list.nix+1
@@ -443,6 +443,7 @@
443443 ./services/misc/logkeys.nix
444444 ./services/misc/leaps.nix
445445 ./services/misc/lidarr.nix
446+ ./services/misc/mame.nix
446447 ./services/misc/mathics.nix
447448 ./services/misc/matrix-synapse.nix
448449 ./services/misc/mbpfan.nix
nixos/modules/services/misc/mame.nixnew file+67
@@ -0,0 +1,67 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.mame;
7+ mame = "mame${lib.optionalString pkgs.stdenv.is64bit "64"}";
8+in
9+{
10+ options = {
11+ services.mame = {
12+ enable = mkOption {
13+ type = types.bool;
14+ default = false;
15+ description = ''
16+ Whether to setup TUN/TAP Ethernet interface for MAME emulator.
17+ '';
18+ };
19+ user = mkOption {
20+ type = types.str;
21+ description = ''
22+ User from which you run MAME binary.
23+ '';
24+ };
25+ hostAddr = mkOption {
26+ type = types.str;
27+ description = ''
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.
30+ '';
31+ example = "192.168.31.156";
32+ };
33+ emuAddr = mkOption {
34+ type = types.str;
35+ description = ''
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</option>.
38+ '';
39+ example = "192.168.31.155";
40+ };
41+ };
42+ };
43+
44+ config = mkIf cfg.enable {
45+ environment.systemPackages = [ pkgs.mame ];
46+
47+ security.wrappers."${mame}" = {
48+ source = "${pkgs.mame}/bin/${mame}";
49+ capabilities = "cap_net_admin,cap_net_raw+eip";
50+ };
51+
52+ systemd.services.mame = {
53+ description = "MAME TUN/TAP Ethernet interface";
54+ after = [ "network.target" ];
55+ wantedBy = [ "multi-user.target" ];
56+ path = [ pkgs.iproute ];
57+ serviceConfig = {
58+ Type = "oneshot";
59+ RemainAfterExit = true;
60+ ExecStart = "${pkgs.mame}/bin/taputil.sh -c ${cfg.user} ${cfg.emuAddr} ${cfg.hostAddr} -";
61+ ExecStop = "${pkgs.mame}/bin/taputil.sh -d ${cfg.user}";
62+ };
63+ };
64+ };
65+
66+ meta.maintainers = with lib.maintainers; [ gnidorah ];
67+}
pkgs/misc/emulators/mame/default.nix+27−12
@@ -1,9 +1,9 @@
1−{ stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem
1+{ stdenv, mkDerivation, fetchFromGitHub, makeDesktopItem, makeWrapper
22, python, pkgconfig, SDL2, SDL2_ttf, alsaLib, which, qtbase, libXinerama }:
33
44let
55 majorVersion = "0";
6− minorVersion = "215";
6+ minorVersion = "216";
77
88 desktopItem = makeDesktopItem {
99 name = "MAME";
@@ -12,6 +12,8 @@ let
1212 genericName = "MAME is a multi-purpose emulation framework";
1313 categories = "System;Emulator;";
1414 };
15+
16+ dest = "$out/opt/mame";
1517in mkDerivation {
1618 pname = "mame";
1719 version = "${majorVersion}.${minorVersion}";
@@ -20,7 +22,7 @@ in mkDerivation {
2022 owner = "mamedev";
2123 repo = "mame";
2224 rev = "mame${majorVersion}${minorVersion}";
23− sha256 = "1phz846p3zzgzrbfiq2vn79iqar2dbf7iv6wfkrp32sdkkvp7l3h";
25+ sha256 = "0dmmw08pxxznvadrc51zg27jc9fjh688355w8kxkmi7k8qa367r0";
2426 };
2527
2628 hardeningDisable = [ "fortify" ];
@@ -28,22 +30,35 @@ in mkDerivation {
2830
2931 makeFlags = [ "TOOLS=1" ];
3032
33+ dontWrapQtApps = true;
34+
3135 buildInputs = [ SDL2 SDL2_ttf alsaLib qtbase libXinerama ];
32− nativeBuildInputs = [ python pkgconfig which ];
36+ nativeBuildInputs = [ python pkgconfig which makeWrapper ];
3337
34− installPhase = ''
35− dest=$out/opt/mame
38+ # by default MAME assumes that paths with stock resources
39+ # are relative and that you run MAME changing to
40+ # install directory, so we add absolute paths here
41+ patches = [ ./emuopts.patch ];
3642
37− make -f dist.mak PTR64=${if stdenv.is64bit then "1" else "0"}
38− mkdir -p $dest
39− mv build/release/${if stdenv.is64bit then "x64" else "x32"}/Release/mame/* $dest
43+ postPatch = ''
44+ substituteInPlace src/emu/emuopts.cpp \
45+ --subst-var-by mame ${dest}
46+ '';
47+
48+ installPhase = ''
49+ make -f dist.mak PTR64=${stdenv.lib.optionalString stdenv.is64bit "1"}
50+ mkdir -p ${dest}
51+ mv build/release/*/Release/mame/* ${dest}
4052
4153 mkdir -p $out/bin
42− find $dest -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
54+ find ${dest} -maxdepth 1 -executable -type f -exec mv -t $out/bin {} \;
55+ install -Dm755 src/osd/sdl/taputil.sh $out/bin/taputil.sh
4356
4457 mkdir -p $out/share/man/man{1,6}
45− mv $dest/docs/man/*.1 $out/share/man/man1
46− mv $dest/docs/man/*.6 $out/share/man/man6
58+ mv ${dest}/docs/man/*.1 $out/share/man/man1
59+ mv ${dest}/docs/man/*.6 $out/share/man/man6
60+
61+ mv artwork plugins samples ${dest}
4762
4863 mkdir -p $out/share
4964 ln -s ${desktopItem}/share/applications $out/share
pkgs/misc/emulators/mame/emuopts.patchnew file+29
@@ -0,0 +1,29 @@
1+diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
2+index c42fcef848..d1bddae060 100644
3+--- a/src/emu/emuopts.cpp
4++++ b/src/emu/emuopts.cpp
5+@@ -36,16 +36,16 @@ const options_entry emu_options::s_option_entries[] =
6+ { nullptr, nullptr, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" },
7+ { OPTION_HOMEPATH, ".", OPTION_STRING, "path to base folder for plugin data (read/write)" },
8+ { OPTION_MEDIAPATH ";rp;biospath;bp", "roms", OPTION_STRING, "path to ROM sets and hard disk images" },
9+- { OPTION_HASHPATH ";hash_directory;hash", "hash", OPTION_STRING, "path to software definition files" },
10+- { OPTION_SAMPLEPATH ";sp", "samples", OPTION_STRING, "path to audio sample sets" },
11+- { OPTION_ARTPATH, "artwork", OPTION_STRING, "path to artwork files" },
12+- { OPTION_CTRLRPATH, "ctrlr", OPTION_STRING, "path to controller definitions" },
13+- { OPTION_INIPATH, ".;ini;ini/presets", OPTION_STRING, "path to ini files" },
14+- { OPTION_FONTPATH, ".", OPTION_STRING, "path to font files" },
15++ { OPTION_HASHPATH ";hash_directory;hash", "hash;@mame@/hash", OPTION_STRING, "path to software definition files" },
16++ { OPTION_SAMPLEPATH ";sp", "samples;@mame@/samples", OPTION_STRING, "path to audio sample sets" },
17++ { OPTION_ARTPATH, "artwork;@mame@/artwork", OPTION_STRING, "path to artwork files" },
18++ { OPTION_CTRLRPATH, "ctrlr;@mame@/ctrlr", OPTION_STRING, "path to controller definitions" },
19++ { OPTION_INIPATH, ".;ini;ini/presets;@mame@/ini/presets", OPTION_STRING, "path to ini files" },
20++ { OPTION_FONTPATH, ".;@mame@", OPTION_STRING, "path to font files" },
21+ { OPTION_CHEATPATH, "cheat", OPTION_STRING, "path to cheat files" },
22+ { OPTION_CROSSHAIRPATH, "crosshair", OPTION_STRING, "path to crosshair files" },
23+- { OPTION_PLUGINSPATH, "plugins", OPTION_STRING, "path to plugin files" },
24+- { OPTION_LANGUAGEPATH, "language", OPTION_STRING, "path to UI translation files" },
25++ { OPTION_PLUGINSPATH, "plugins;@mame@/plugins", OPTION_STRING, "path to plugin files" },
26++ { OPTION_LANGUAGEPATH, "language;@mame@/language", OPTION_STRING, "path to UI translation files" },
27+ { OPTION_SWPATH, "software", OPTION_STRING, "path to loose software" },
28+
29+ // output directory options