lmxg-mu50/package.nix
2025-03-04 10:26:15 +08:00

60 lines
1.0 KiB
Nix

{
stdenv,
fetchurl,
# dependencies
mame,
which,
p7zip,
...
}:
let
bin = ./lmxg-mu50;
desktop = ./lmxg-mu50.desktop;
icon = ./lmxg-mu50.png;
in
stdenv.mkDerivation rec {
pname = "lmxg-mu50";
version = "0.1.0";
src = fetchurl {
url = "https://mdk.cab/download/nonmerged/mu50";
sha256 = "sha256-0hzR2EWmamLJrqJ6cXaReEgd8Ha4Sf7LENpIYqcbCgs=";
};
nativeBuildInputs = [
p7zip
];
buildInputs = [
mame
which
];
phases = [
"unpackPhase"
"installPhase"
];
unpackPhase = ''
mkdir -p mu50
cd mu50
7z x $src
cd ../
'';
installPhase = ''
mkdir -p $out/bin
cat ${bin} | sed "s|@DIR@|$out|" > $out/bin/${pname}
chmod +x $out/bin/${pname}
mkdir -p $out/share/applications
cat ${desktop} | sed "s|@EXEC@|$out/bin/${pname}|" > $out/share/applications/${pname}.desktop
mkdir -p $out/share/pixmaps
cp ${icon} $out/share/pixmaps/${pname}.png
mkdir -p $out/share/mame/assets/mu50
cp -r /build/mu50 $out/share/mame/assets/
'';
}