From 44ab1ad7f3858215c6abec0ee14cbd9b6d69c9ab Mon Sep 17 00:00:00 2001 From: Matthew Deville Date: Sat, 30 Aug 2025 23:59:42 +0200 Subject: [PATCH] wip --- flake.lock | 96 +++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 62 ++++++++++++++--------------- rust-toolchain.toml | 2 + 3 files changed, 129 insertions(+), 31 deletions(-) create mode 100644 flake.lock create mode 100644 rust-toolchain.toml diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fd9c2fc --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1756469547, + "narHash": "sha256-YvtD2E7MYsQ3r7K9K2G7nCslCKMPShoSEAtbjHLtH0k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41d292bfc37309790f70f4c120b79280ce40af16", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1756521112, + "narHash": "sha256-/YW9DI+vZ2lbTvYAek6BsudUXdpWr0FybTDod4P42L4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2243e3f251ea18486f83133cf8e325d2b9b71e89", + "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/flake.nix b/flake.nix index 6c02d2b..229c5ae 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Bevy project with Rust and dependencies via nixpkgs and oxalica/rust-overlay"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; rust-overlay.url = "github:oxalica/rust-overlay"; flake-utils.url = "github:numtide/flake-utils"; }; @@ -19,40 +19,40 @@ let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; - rustToolchain = pkgs.rust-bin.stable.latest.default; + rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + nativeBuildInputs = with pkgs; [ + rustToolchain + mold + pkg-config + ]; + + xorgBuildInputs = with pkgs; [ + xorg.libX11 + xorg.libXcursor + xorg.libXi + ]; + waylandBuildInputs = with pkgs; [ + libxkbcommon + wayland + ]; + buildInputs = + with pkgs; + [ + alsa-lib + systemd + vulkan-loader + ] + ++ xorgBuildInputs + ++ waylandBuildInputs; in { devShells.default = pkgs.mkShell { - buildInputs = [ - rustToolchain - pkgs.pkg-config - pkgs.alsa-lib - pkgs.udev - pkgs.vulkan-loader - pkgs.vulkan-tools - pkgs.xorg.libX11 - pkgs.xorg.libXcursor - pkgs.xorg.libXi - pkgs.xorg.libXrandr - pkgs.xorg.libXxf86vm - pkgs.xorg.libXinerama - pkgs.xorg.libXext - pkgs.xorg.libxcb - pkgs.xorg.libXrender - pkgs.xorg.libXfixes - pkgs.xorg.libXau - pkgs.xorg.libXdmcp - pkgs.mesa - pkgs.libGL - pkgs.wayland - pkgs.dbus - pkgs.libxkbcommon - pkgs.fontconfig - pkgs.freetype - pkgs.zlib - pkgs.openssl - ]; + inherit buildInputs nativeBuildInputs; + RUST_BACKTRACE = 1; + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath buildInputs}" + ''; }; } ); diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"