- Created new crate `bevy_vanth` with basic plugin structure for Bevy integration. - Refactored `Id` generation in `vanth` to use `OsRng` and removed redundant `to_u128_pair`/`from_u128_pair` methods. - Moved networking functionality into new `net` module with `Node`, `Packet`, and `Message` types. - Updated `vanth_derive` to use `proc-macro-crate` for reliable crate path resolution. - Added `rand` dependency to replace custom ID generation logic. - Updated `Cargo.toml`/`Cargo.lock` with new dependencies: `bevy_app`, `nix`, `cfg_aliases`, `proc-macro-crate`. - Modified `README.md` with improved project description. - Added commented clippy check in `flake.nix`.
127 lines
4.8 KiB
Nix
127 lines
4.8 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
crane.url = "github:ipetkov/crane";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
};
|
|
|
|
outputs =
|
|
inputs:
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
"x86_64-darwin"
|
|
"x86_64-linux"
|
|
];
|
|
|
|
perSystem =
|
|
{ system, ... }:
|
|
let
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
overlays = [ inputs.rust-overlay.overlays.default ];
|
|
};
|
|
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
|
|
|
|
packages =
|
|
with pkgs;
|
|
[
|
|
dbus
|
|
libssh2
|
|
makeWrapper
|
|
openssl
|
|
openssl.dev
|
|
pkg-config
|
|
]
|
|
++ lib.optionals stdenv.isLinux [
|
|
systemd
|
|
patchelf
|
|
]
|
|
++ lib.optionals stdenv.isDarwin [
|
|
libiconv
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
darwin.apple_sdk.frameworks.AudioUnit
|
|
darwin.apple_sdk.frameworks.CoreAudio
|
|
];
|
|
|
|
commonArgs = {
|
|
src = ./.;
|
|
strictDeps = true;
|
|
nativeBuildInputs = packages;
|
|
buildInputs = packages;
|
|
checkPhase = "";
|
|
|
|
CARGO_BUILD_INCREMENTAL = "false";
|
|
RUST_BACKTRACE = "1";
|
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
|
|
};
|
|
|
|
craneArgs = {
|
|
};
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly (
|
|
commonArgs
|
|
// craneArgs
|
|
// {
|
|
pname = "vanth-deps";
|
|
version = "0.1.0";
|
|
}
|
|
);
|
|
|
|
vanth = craneLib.buildPackage (
|
|
commonArgs
|
|
// craneArgs
|
|
// {
|
|
inherit cargoArtifacts;
|
|
pname = "vanth";
|
|
version = "0.1.0";
|
|
cargoExtraArgs = "--package vanth_cli";
|
|
|
|
postInstall = ''
|
|
if [ ! -f "$out/bin/vanth" ]; then
|
|
echo "Error: vanth binary not found in $out/bin/"
|
|
ls -la $out/bin/
|
|
exit 1
|
|
fi
|
|
''
|
|
+ pkgs.lib.optionalString pkgs.stdenv.isLinux ''
|
|
patchelf $out/bin/vanth --set-rpath ${pkgs.lib.makeLibraryPath packages}
|
|
wrapProgram $out/bin/vanth --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath packages}"
|
|
'';
|
|
}
|
|
);
|
|
|
|
clippyCheck = craneLib.cargoClippy (
|
|
commonArgs
|
|
// craneArgs
|
|
// {
|
|
inherit cargoArtifacts;
|
|
pname = "vanth-clippy";
|
|
version = "0.1.0";
|
|
# Fail on any lint warning and cover all targets/features.
|
|
cargoClippyExtraArgs = "--all-targets --all-features -- -D warnings";
|
|
}
|
|
);
|
|
in
|
|
{
|
|
packages = rec {
|
|
inherit vanth;
|
|
default = vanth;
|
|
};
|
|
|
|
checks = {
|
|
# clippy = clippyCheck;
|
|
};
|
|
|
|
devShells.default = craneLib.devShell {
|
|
inputsFrom = [ vanth ];
|
|
packages = packages;
|
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
|
|
};
|
|
};
|
|
};
|
|
}
|