2024-05-20 01:21:10 +00:00
|
|
|
{ lib
|
|
|
|
, self ? null
|
|
|
|
, buildType ? "release"
|
|
|
|
, platform ? "linux"
|
|
|
|
, enableWayland ? true
|
|
|
|
, enableXorg ? true
|
|
|
|
, enableOpenGL ? true
|
|
|
|
, enableVulkan ? true
|
|
|
|
, rustPlatform
|
|
|
|
, makeDesktopItem
|
|
|
|
, pkg-config
|
|
|
|
, libxkbcommon
|
|
|
|
, alsa-lib
|
|
|
|
, libGL
|
|
|
|
, vulkan-loader
|
|
|
|
, wayland
|
|
|
|
, libXrandr
|
|
|
|
, libXcursor
|
|
|
|
, libX11
|
|
|
|
, libXi
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert (platform == "linux" ) -> (enableWayland || enableXorg);
|
|
|
|
assert (platform == "linux" ) -> (enableVulkan || enableOpenGL);
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
name = "outfly";
|
|
|
|
inherit buildType;
|
2024-06-06 15:26:38 +00:00
|
|
|
src = ./../..;
|
2024-05-20 01:21:10 +00:00
|
|
|
version = if (self ? rev) then self.rev else "dirty";
|
|
|
|
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
buildFeatures = [ "embed_assets" ] ++ lib.optionals enableXorg [ "x11" ]
|
|
|
|
++ lib.optionals enableWayland [ "wayland" ];
|
|
|
|
|
|
|
|
runtimeInputs = [ libxkbcommon ]
|
|
|
|
++ lib.optionals enableOpenGL [ libGL ]
|
|
|
|
++ lib.optionals enableXorg [ libXrandr libX11 ]
|
|
|
|
++ lib.optionals enableVulkan [ vulkan-loader ];
|
|
|
|
|
|
|
|
buildInputs = [ alsa-lib.dev libXcursor libXi ]
|
|
|
|
++ lib.optionals enableWayland [ wayland ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
patchelf $out/bin/outfly \
|
|
|
|
--add-rpath ${lib.makeLibraryPath runtimeInputs}
|
|
|
|
'';
|
|
|
|
|
2024-06-06 15:26:38 +00:00
|
|
|
postPatch = ''
|
|
|
|
find ../cargo-vendor-dir -name Cargo.toml -exec sed -i 's/^workspace = true//' {} +
|
|
|
|
'';
|
|
|
|
|
|
|
|
cargoLock = { lockFile = ./../../Cargo.lock; };
|
2024-05-20 01:21:10 +00:00
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "outfly";
|
|
|
|
exec = "outfly";
|
2024-06-06 15:26:38 +00:00
|
|
|
|
2024-05-20 01:21:10 +00:00
|
|
|
desktopName = "OutFly";
|
|
|
|
categories = [ "Game" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|