summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2023-11-19 12:15:52 -0500
committerKjetil Orbekk <kj@orbekk.com>2023-11-19 17:34:59 -0500
commitd5a1aa8daaf1371d6b0032636c5c668dea581a3b (patch)
treecc4f4718929d7b6e25986c6939a67a46a2cb9a4d
parentec985c98d61ec96bebf0ba068cf5e88fa13b2f40 (diff)
bevy
-rw-r--r--bevy/.cargo/config.toml3
-rw-r--r--bevy/Cargo.toml17
-rw-r--r--bevy/flake.lock96
-rw-r--r--bevy/flake.nix11
-rw-r--r--lisp/.envrc1
-rw-r--r--lisp/flake.nix67
6 files changed, 190 insertions, 5 deletions
diff --git a/bevy/.cargo/config.toml b/bevy/.cargo/config.toml
new file mode 100644
index 0000000..d29d6c3
--- /dev/null
+++ b/bevy/.cargo/config.toml
@@ -0,0 +1,3 @@
+[target.x86_64-unknown-linux-gnu]
+linker = "clang"
+rustflags = ["-C", "link-arg=-fuse-ld=mold"]
diff --git a/bevy/Cargo.toml b/bevy/Cargo.toml
new file mode 100644
index 0000000..ce34f03
--- /dev/null
+++ b/bevy/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "bevy"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+bevy = { version = "0.12", features = ["wayland", "dynamic_linking"] }
+
+# Enable a small amount of optimization in debug mode
+[profile.dev]
+opt-level = 1
+
+# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
+[profile.dev.package."*"]
+opt-level = 3
diff --git a/bevy/flake.lock b/bevy/flake.lock
new file mode 100644
index 0000000..3e63cd4
--- /dev/null
+++ b/bevy/flake.lock
@@ -0,0 +1,96 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1681202837,
+ "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1699291058,
+ "narHash": "sha256-5ggduoaAMPHUy4riL+OrlAZE14Kh7JWX4oLEs22ZqfU=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "41de143fda10e33be0f47eab2bfe08a50f234267",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-23.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1681358109,
+ "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "rust-overlay": "rust-overlay"
+ }
+ },
+ "rust-overlay": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs_2"
+ },
+ "locked": {
+ "lastModified": 1699323235,
+ "narHash": "sha256-ZFRItRv0dDSzsfpqSjj9qWM/SA1kRrOk6R04qhBZuxM=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "8a9d6f544c08ee898c7f3761cc9587be7565db5e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "type": "github"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/bevy/flake.nix b/bevy/flake.nix
index 4fb6ce7..bcb4de0 100644
--- a/bevy/flake.nix
+++ b/bevy/flake.nix
@@ -18,18 +18,19 @@
rustPlatform = pkgs.makeRustPlatform { cargo = rust; rustc = rust; };
shellInputs = with pkgs; [
- rust clang mold
+ rust clang mold rust-analyzer
];
appNativeBuildInputs = with pkgs; [
pkg-config
];
appBuildInputs = appRuntimeInputs ++ (with pkgs; [
- udev alsaLib x11
- vulkan-tools vulkan-headers vulkan-validation-layers
]);
appRuntimeInputs = with pkgs; [
- vulkan-loader
- xlibs.libXcursor xlibs.libXi xlibs.libXrandr
+ vulkan-loader udev
+ wayland wayland-protocols
+ libxkbcommon
+ alsaLib
+ vulkan-tools vulkan-headers vulkan-validation-layers
];
in
{
diff --git a/lisp/.envrc b/lisp/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/lisp/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/lisp/flake.nix b/lisp/flake.nix
new file mode 100644
index 0000000..4418230
--- /dev/null
+++ b/lisp/flake.nix
@@ -0,0 +1,67 @@
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
+ rust-overlay.url = "github:oxalica/rust-overlay";
+ };
+
+ outputs = { self, nixpkgs, rust-overlay }:
+ let
+ overlays = [ (import rust-overlay) ];
+ pkgs = import nixpkgs {
+ inherit system overlays;
+ };
+
+ system = "x86_64-linux";
+ app = "lisp";
+
+ rust = pkgs.rust-bin.nightly.latest.default.override { extensions = [ "rust-src" ]; };
+ rustPlatform = pkgs.makeRustPlatform { cargo = rust; rustc = rust; };
+
+ shellInputs = with pkgs; [
+ rust clang mold rust-analyzer
+ ];
+ appNativeBuildInputs = with pkgs; [
+ pkg-config
+ ];
+ appBuildInputs = appRuntimeInputs ++ (with pkgs; [
+ ]);
+ appRuntimeInputs = with pkgs; [
+ ];
+ in
+ {
+ devShells.${system}.${app} = pkgs.mkShell {
+ nativeBuildInputs = appNativeBuildInputs;
+ buildInputs = shellInputs ++ appBuildInputs;
+
+ shellHook = ''
+ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath appRuntimeInputs}"
+ ln -fsT ${rust} ./.direnv/rust
+ '';
+ };
+ devShell.${system} = self.devShells.${system}.${app};
+
+ packages.${system}.${app} = rustPlatform.buildRustPackage {
+ pname = app;
+ version = "0.1.0";
+
+ src = ./.;
+ cargoSha256 = "sha256-lzs+8qAsBJ/ms/OppxnKfJChV9+xM0W/QRZGPn+9uv4=";
+
+ nativeBuildInputs = appNativeBuildInputs;
+ buildInputs = appBuildInputs;
+
+ postInstall = ''
+ cp -r assets $out/bin/
+ '';
+ };
+ defaultPackage.${system} = self.packages.${system}.${app};
+
+ apps.${system}.${app} = {
+ type = "app";
+ program = "${self.packages.${system}.${app}}/bin/${app}";
+ };
+ defaultApp.${system} = self.apps.${system}.${app};
+
+ checks.${system}.build = self.packages.${system}.${app};
+ };
+}