dev: nix environment
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
{ inputs, flake, self, pkgs }:
|
||||||
|
let
|
||||||
|
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml;
|
||||||
|
runtimeLibraries = with pkgs; [
|
||||||
|
alsa-lib
|
||||||
|
vulkan-loader
|
||||||
|
udev
|
||||||
|
libx11
|
||||||
|
libxcursor
|
||||||
|
libxi
|
||||||
|
libxrandr
|
||||||
|
libxkbcommon
|
||||||
|
wayland
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
rustToolchain
|
||||||
|
stdenv.cc
|
||||||
|
git
|
||||||
|
pkg-config
|
||||||
|
shellcheck
|
||||||
|
file
|
||||||
|
openssl
|
||||||
|
] ++ runtimeLibraries;
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library"
|
||||||
|
|
||||||
|
if [ -d /run/opengl-driver/lib ]; then
|
||||||
|
export LD_LIBRARY_PATH="/run/opengl-driver/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath runtimeLibraries}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||||
|
|
||||||
|
if git_root=$(${pkgs.git}/bin/git rev-parse --show-toplevel 2>/dev/null); then
|
||||||
|
export LOCAL_DIR="$git_root"
|
||||||
|
else
|
||||||
|
export LOCAL_DIR="$PWD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "bevy_controls dev shell"
|
||||||
|
printf '%s\n' "Library: cargo check && cargo test"
|
||||||
|
printf '%s\n' "Example: cd crate/bevy_controls/example/basic && cargo run --features x11"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
Generated
+1236
-15
File diff suppressed because it is too large
Load Diff
@@ -1,38 +1,28 @@
|
|||||||
{
|
{
|
||||||
|
description = "Bevy controls library and examples";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
hearth = {
|
||||||
|
url = "git+https://gitea.hectic-lab.com/hinterland/hearth.git";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs = {
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nixpkgs.follows = "nixpkgs";
|
|
||||||
flake-utils.follows = "flake-utils";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
outputs = { self, hearth, ... }@inputs:
|
||||||
flake-utils.lib.eachDefaultSystem
|
let
|
||||||
(system:
|
flake = builtins.warn "Using the `flake` variable may produce a large source closure." ./.;
|
||||||
let
|
lib = import ./lib { inherit inputs flake self; };
|
||||||
overlays = [ (import rust-overlay) ];
|
in
|
||||||
pkgs = import nixpkgs {
|
hearth.lib.forAllSystemsWithPkgs lib.composedOverlays ({ system, pkgs }: {
|
||||||
inherit system overlays;
|
legacyPackages.${system} = pkgs;
|
||||||
};
|
packages.${system} = import ./package { inherit self inputs flake pkgs; };
|
||||||
rustToolchain = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
devShells.${system} = import ./devshell { inherit self inputs flake pkgs; };
|
||||||
nativeBuildInputs = with pkgs; [ rustToolchain pkg-config ];
|
}) // {
|
||||||
buildInputs = with pkgs; [
|
inherit lib;
|
||||||
openssl
|
};
|
||||||
shellcheck
|
|
||||||
file
|
|
||||||
];
|
|
||||||
in
|
|
||||||
with pkgs;
|
|
||||||
{
|
|
||||||
devShells.default = mkShell {
|
|
||||||
inherit buildInputs nativeBuildInputs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{ self, flake, inputs }:
|
||||||
|
let
|
||||||
|
overlays = with inputs; [
|
||||||
|
hearth.overlays.default
|
||||||
|
(import rust-overlay)
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
nixpkgs-lib = inputs.nixpkgs.lib;
|
||||||
|
composedOverlays = overlays;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
let
|
||||||
|
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;
|
||||||
|
rustPlatform = pkgs.makeRustPlatform {
|
||||||
|
rustc = rustToolchain;
|
||||||
|
cargo = rustToolchain;
|
||||||
|
};
|
||||||
|
in rustPlatform.buildRustPackage {
|
||||||
|
pname = "bevy-controls";
|
||||||
|
version = "0.1.0";
|
||||||
|
src = ../..;
|
||||||
|
|
||||||
|
cargoLock.lockFile = ../../Cargo.lock;
|
||||||
|
cargoBuildFlags = [ "--workspace" ];
|
||||||
|
cargoTestFlags = [ "--workspace" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
openssl
|
||||||
|
alsa-lib
|
||||||
|
vulkan-loader
|
||||||
|
udev
|
||||||
|
libx11
|
||||||
|
libxcursor
|
||||||
|
libxi
|
||||||
|
libxrandr
|
||||||
|
libxkbcommon
|
||||||
|
wayland
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
touch "$out/workspace-built"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
bevy-controls = import ./bevy-controls { inherit pkgs; };
|
||||||
|
default = import ./bevy-controls { inherit pkgs; };
|
||||||
|
}
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = '1.79.0'
|
channel = '1.79.0'
|
||||||
components = ["rustfmt", "clippy"]
|
components = ["rustfmt", "clippy", "rust-src"]
|
||||||
|
|||||||
Reference in New Issue
Block a user