2024-08-08 03:36:06 +00:00
|
|
|
{
|
|
|
|
description = "Nintendo DS emulator";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
inherit (pkgs.lib) cmakeBool optionals makeLibraryPath;
|
|
|
|
inherit (pkgs.stdenv) isLinux isDarwin;
|
|
|
|
|
2024-10-24 20:05:30 +00:00
|
|
|
revision = with self; if sourceInfo?dirtyRev
|
|
|
|
then sourceInfo.dirtyRev
|
|
|
|
else sourceInfo.rev;
|
|
|
|
shortRevision = with self; if sourceInfo?dirtyShortRev
|
2024-08-08 03:36:06 +00:00
|
|
|
then sourceInfo.dirtyShortRev
|
|
|
|
else sourceInfo.shortRev;
|
|
|
|
|
2024-11-05 06:58:31 +00:00
|
|
|
melonDS = pkgs.stdenv.mkDerivation {
|
2024-08-08 03:36:06 +00:00
|
|
|
pname = "melonDS";
|
2024-11-20 23:21:47 +00:00
|
|
|
version = "1.0-${shortRevision}";
|
2024-08-08 03:36:06 +00:00
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2024-09-13 03:42:20 +00:00
|
|
|
qt6.wrapQtAppsHook
|
2024-08-08 03:36:06 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = (with pkgs; [
|
2024-09-13 03:42:20 +00:00
|
|
|
qt6.qtbase
|
|
|
|
qt6.qtmultimedia
|
2024-08-08 03:36:06 +00:00
|
|
|
SDL2
|
|
|
|
zstd
|
|
|
|
libarchive
|
|
|
|
libGL
|
|
|
|
libslirp
|
2024-08-10 21:20:50 +00:00
|
|
|
enet
|
2024-09-13 03:42:20 +00:00
|
|
|
]) ++ optionals (!isDarwin) (with pkgs; [
|
|
|
|
kdePackages.extra-cmake-modules
|
|
|
|
qt6.qtwayland
|
|
|
|
wayland
|
|
|
|
]);
|
2024-08-08 03:36:06 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
(cmakeBool "USE_QT6" true)
|
|
|
|
(cmakeBool "USE_SYSTEM_LIBSLIRP" true)
|
2024-10-24 20:05:30 +00:00
|
|
|
(cmakeBool "MELONDS_EMBED_BUILD_INFO" true)
|
2024-08-08 03:36:06 +00:00
|
|
|
];
|
|
|
|
|
2024-10-24 20:05:30 +00:00
|
|
|
env.MELONDS_GIT_HASH = revision;
|
|
|
|
env.MELONDS_GIT_BRANCH = "(unknown)";
|
|
|
|
env.MELONDS_BUILD_PROVIDER = "Nix";
|
|
|
|
|
2024-08-08 03:36:06 +00:00
|
|
|
qtWrapperArgs = optionals isLinux [
|
2024-08-11 02:54:05 +00:00
|
|
|
"--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ pkgs.libpcap pkgs.wayland ]}"
|
2024-08-08 03:36:06 +00:00
|
|
|
] ++ optionals isDarwin [
|
|
|
|
"--prefix DYLD_LIBRARY_PATH : ${makeLibraryPath [ pkgs.libpcap ]}"
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
exePath = if isDarwin then
|
|
|
|
"/Applications/melonDS.app/Contents/MacOS/melonDS"
|
|
|
|
else "/bin/melonDS";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
packages.default = melonDS;
|
|
|
|
apps.default = flake-utils.lib.mkApp {
|
|
|
|
drv = self.packages.${system}.default;
|
|
|
|
};
|
2024-09-06 17:44:48 +00:00
|
|
|
devShells = {
|
2024-11-05 06:58:31 +00:00
|
|
|
default = pkgs.mkShell {
|
2024-09-06 17:44:48 +00:00
|
|
|
inputsFrom = [ self.packages.${system}.default ];
|
2024-11-05 06:58:31 +00:00
|
|
|
packages = with pkgs; [
|
|
|
|
qt6.qttools
|
|
|
|
];
|
2024-09-06 17:44:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Shell for building static melonDS release builds with vcpkg
|
|
|
|
# Use mkShellNoCC to ensure Nix's gcc/clang and stdlib isn't used
|
|
|
|
vcpkg = pkgs.mkShellNoCC {
|
|
|
|
packages = with pkgs; [
|
|
|
|
autoconf
|
|
|
|
autoconf-archive
|
|
|
|
automake
|
|
|
|
cmake
|
|
|
|
cups.dev # Needed by qtbase despite not enabling print support
|
|
|
|
git
|
|
|
|
iconv.dev
|
|
|
|
libtool
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
};
|
2024-08-08 03:36:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|