From f063db35680369e82e2b0bedd8b0fe769a8c63f7 Mon Sep 17 00:00:00 2001 From: yukkop Date: Thu, 3 Sep 2026 20:12:49 +0000 Subject: [PATCH] dev: nix environment --- devshell/default.nix | 47 ++ flake.lock | 1251 ++++++++++++++++++++++++++++- flake.nix | 48 +- lib/default.nix | 10 + package/bevy-controls/default.nix | 38 + package/default.nix | 5 + rust-toolchain.toml | 2 +- 7 files changed, 1356 insertions(+), 45 deletions(-) create mode 100644 devshell/default.nix create mode 100644 lib/default.nix create mode 100644 package/bevy-controls/default.nix create mode 100644 package/default.nix diff --git a/devshell/default.nix b/devshell/default.nix new file mode 100644 index 0000000..55813fa --- /dev/null +++ b/devshell/default.nix @@ -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" + ''; + }; +} diff --git a/flake.lock b/flake.lock index a67e1df..3eef127 100644 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,259 @@ { "nodes": { - "flake-utils": { + "aquamarine": { "inputs": { - "systems": "systems" + "hyprutils": [ + "hearth", + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hearth", + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1751740947, + "narHash": "sha256-35040CHH7P3JGmhGVfEb2oJHL/A5mI2IXumhkxrBnao=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "dfc1db15a08c4cd234288f66e1199c653495301f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, + "blobs": { + "flake": false, + "locked": { + "lastModified": 1604995301, + "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "type": "gitlab" + } + }, + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "hearth", + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1749105467, + "narHash": "sha256-hXh76y/wDl15almBcqvjryB50B0BaiXJKk20f314RoE=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "6bc76b872374845ba9d645a2f012b764fecd765f", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752718651, + "narHash": "sha256-PkaR0qmyP9q/MDN3uYa+RLeBA0PjvEQiM0rTDDBXkL8=", + "owner": "nix-community", + "repo": "disko", + "rev": "d5ad4485e6f2edcc06751df65c5e16572877db88", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "disko_2": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixos-anywhere", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749200714, + "narHash": "sha256-W8KiJIrVwmf43JOPbbTu5lzq+cmdtRqaNbOsZigjioY=", + "owner": "nix-community", + "repo": "disko", + "rev": "17d08c65c241b1d65b3ddf79e3fac1ddc870b0f6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "disko", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "hearth", + "nixos-anywhere", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748821116, + "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "hearth", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -18,13 +262,728 @@ "type": "github" } }, - "nixpkgs": { + "git-hooks": { + "inputs": { + "flake-compat": [ + "hearth", + "nixos-mailserver", + "flake-compat" + ], + "gitignore": "gitignore_2", + "nixpkgs": [ + "hearth", + "nixos-mailserver", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1775585728, + "narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "580633fa3fe5fc0379905986543fd7495481913d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "hearth", + "hyprland", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixos-mailserver", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hearth": { + "inputs": { + "deploy-rs": "deploy-rs", + "disko": "disko", + "hectic-landing": "hectic-landing", + "home-manager": "home-manager", + "hyprland": "hyprland", + "impermanence": "impermanence", + "mechabellum-replay-analysis": "mechabellum-replay-analysis", + "nix-darwin": "nix-darwin", + "nix-minecraft": "nix-minecraft", + "nixos-anywhere": "nixos-anywhere", + "nixos-hardware": "nixos-hardware", + "nixos-mailserver": "nixos-mailserver", + "nixos-wsl": "nixos-wsl", + "nixpkgs": [ + "nixpkgs" + ], + "nixvim": "nixvim", + "rust-overlay": "rust-overlay", + "sops-nix": "sops-nix" + }, + "locked": { + "lastModified": 1788426007, + "narHash": "sha256-+6mYOgSCkfv2H5ImVlNNKJ40/BXFxlxYEDvFokjIa3U=", + "ref": "refs/heads/master", + "rev": "2fbd776fc1a607028283f9769d86f37904a9aa64", + "revCount": 518, + "type": "git", + "url": "https://gitea.hectic-lab.com/hinterland/hearth.git" + }, + "original": { + "type": "git", + "url": "https://gitea.hectic-lab.com/hinterland/hearth.git" + } + }, + "hectic-landing": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777564161, + "narHash": "sha256-2ZyXQDOTtcB6B7pSJnSrmGyUcC/JUrfBl6RbvnKwzcE=", + "ref": "refs/heads/main", + "rev": "88bae39c4c60fdffa1b20f533146b41bfbe8e1c5", + "revCount": 8, + "type": "git", + "url": "ssh://git@github.com/liquizz/hectic-landing.git" + }, + "original": { + "type": "git", + "url": "ssh://git@github.com/liquizz/hectic-landing.git" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1770260404, + "narHash": "sha256-3iVX1+7YUIt23hBx1WZsUllhbmP2EnXrV8tCRbLxHc8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0d782ee42c86b196acff08acfbf41bb7d13eed5b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hearth", + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1749155331, + "narHash": "sha256-XR9fsI0zwLiFWfqi/pdS/VD+YNorKb3XIykgTg4l1nA=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "45fcc10b4c282746d93ec406a740c43b48b4ef80", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprgraphics": { + "inputs": { + "hyprutils": [ + "hearth", + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751808145, + "narHash": "sha256-OXgL0XaKMmfX2rRQkt9SkJw+QNfv0jExlySt1D6O72g=", + "owner": "hyprwm", + "repo": "hyprgraphics", + "rev": "b841473a0bd4a1a74a0b64f1ec2ab199035c349f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprgraphics", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "aquamarine": "aquamarine", + "hyprcursor": "hyprcursor", + "hyprgraphics": "hyprgraphics", + "hyprland-protocols": "hyprland-protocols", + "hyprland-qtutils": "hyprland-qtutils", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": [ + "hearth", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks", + "systems": "systems_2", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1752698382, + "narHash": "sha256-fxax8Xpn59Uqwj753Cp1KAtI09Wd7zbgTZNxtFKzhJk=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "49d73d1893168f493b41ac9873f6022d79e75c83", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1749046714, + "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-qt-support": { + "inputs": { + "hyprlang": [ + "hearth", + "hyprland", + "hyprland-qtutils", + "hyprlang" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "hyprland-qtutils", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "hyprland-qtutils", + "systems" + ] + }, + "locked": { + "lastModified": 1749154592, + "narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=", + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "type": "github" + } + }, + "hyprland-qtutils": { + "inputs": { + "hyprland-qt-support": "hyprland-qt-support", + "hyprlang": [ + "hearth", + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hearth", + "hyprland", + "hyprland-qtutils", + "hyprlang", + "hyprutils" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1750371812, + "narHash": "sha256-D868K1dVEACw17elVxRgXC6hOxY+54wIEjURztDWLk8=", + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "rev": "b13c7481e37856f322177010bdf75fccacd1adc8", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hearth", + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1750371198, + "narHash": "sha256-/iuJ1paQOBoSLqHflRNNGyroqfF/yvPNurxzcCT0cAE=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "cee01452bca58d6cadb3224e21e370de8bc20f0b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751888065, + "narHash": "sha256-F2SV9WGqgtRsXIdUrl3sRe0wXlQD+kRRZcSfbepjPJY=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "a8229739cf36d159001cfc203871917b83fdf917", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751881472, + "narHash": "sha256-meB0SnXbwIe2trD041MLKEv6R7NZ759QwBcVIhlSBfE=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "8fb426b3e5452fd9169453fd6c10f8c14ca37120", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, + "impermanence": { + "locked": { + "lastModified": 1737831083, + "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "hearth", + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "hearth", + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.8", + "repo": "ixx", + "type": "github" + } + }, + "mechabellum-replay-analysis": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780905541, + "narHash": "sha256-hxaKZTcowCDF5RfcCZIWpRY9/ZMm2zJyInNnovBayRg=", + "ref": "refs/heads/master", + "rev": "6f1f292db325145bbdf4d0452ce16963c07ecdb1", + "revCount": 123, + "type": "git", + "url": "ssh://git@github.com/LysmiMx/mechabellum-replay-analysis.git" + }, + "original": { + "type": "git", + "url": "ssh://git@github.com/LysmiMx/mechabellum-replay-analysis.git" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772129556, + "narHash": "sha256-Utk0zd8STPsUJPyjabhzPc5BpPodLTXrwkpXBHYnpeg=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "ebec37af18215214173c98cf6356d0aca24a2585", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "nix-darwin-25.11", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat_3", + "nixpkgs": "nixpkgs", + "systems": "systems_3" + }, + "locked": { + "lastModified": 1777001712, + "narHash": "sha256-9JX9msZU1NvHzjKM24PRorP76Ge8GBy6LAkJKA21mlY=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "394d3bfd943458baf29e4798bc9b256d824a3bb9", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, + "nix-vm-test": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixos-anywhere", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748765518, + "narHash": "sha256-vftOR+7zwnMWl5UpG32GL1VBeNGTDZZT0hv+2uNuBGw=", + "owner": "Mic92", + "repo": "nix-vm-test", + "rev": "d6642fbaf42fc98883d84bab66cd0ec720d9dd0c", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-vm-test", + "type": "github" + } + }, + "nixos-anywhere": { + "inputs": { + "disko": "disko_2", + "flake-parts": "flake-parts", + "nix-vm-test": "nix-vm-test", + "nixos-images": "nixos-images", + "nixos-stable": "nixos-stable", + "nixpkgs": [ + "hearth", + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1760107790, + "narHash": "sha256-7zuh0xtYZnfyibIRCiK4KthXNZIV/9pa7wSjNJUV3Qk=", + "owner": "nix-community", + "repo": "nixos-anywhere", + "rev": "25d23ef77d2c54ad1c08caafee022834265804dc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-anywhere", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1760106635, + "narHash": "sha256-2GoxVaKWTHBxRoeUYSjv0AfSOx4qw5CWSFz2b+VolKU=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "9ed85f8afebf2b7478f25db0a98d0e782c0ed903", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixos-images": { + "inputs": { + "nixos-stable": [ + "hearth", + "nixos-anywhere", + "nixos-stable" + ], + "nixos-unstable": [ + "hearth", + "nixos-anywhere", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749086071, + "narHash": "sha256-4+fY7i+q78F3t6APz0cMC4kRxsyCb+UTyfhbckkCd7Q=", + "owner": "nix-community", + "repo": "nixos-images", + "rev": "aa38dbbdf0e955baef7e03dfc4265ae3fdac4808", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-images", + "type": "github" + } + }, + "nixos-mailserver": { + "inputs": { + "blobs": "blobs", + "flake-compat": "flake-compat_4", + "git-hooks": "git-hooks", + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764075412, + "narHash": "sha256-d1+H7z21NsXgk9vL/9LAPUuiKrq9iqFxxqAWNNk1gY0=", + "owner": "simple-nixos-mailserver", + "repo": "nixos-mailserver", + "rev": "8d35f004eeb47cfcfa5c4e1c8765f5c1bf64b9a0", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "ref": "snm-25.11", + "repo": "nixos-mailserver", + "type": "gitlab" + } + }, + "nixos-stable": { + "locked": { + "lastModified": 1749086602, + "narHash": "sha256-DJcgJMekoxVesl9kKjfLPix2Nbr42i7cpEHJiTnBUwU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "4792576cb003c994bd7cc1edada3129def20b27d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixos-wsl": { + "inputs": { + "flake-compat": "flake-compat_5", + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771563879, + "narHash": "sha256-vA5hocvdGhr+jfBN7A7ogeZqIz2qx01EixXwdVsQcnE=", + "owner": "nix-community", + "repo": "NixOS-WSL", + "rev": "379d20c55f552e91fb9f3f0382e4a97d3f452943", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NixOS-WSL", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1769461804, + "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1788316716, + "narHash": "sha256-bc7rSpXIdn9QWGNqfWcPZWOhEVF8NoeAZkWq0XWnf/k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3ed67ec0a4d3c7ab4ae1f04f8ee8df07bfa506a2", "type": "github" }, "original": { @@ -34,25 +993,119 @@ "type": "github" } }, - "root": { + "nixvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "hearth", + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "systems": "systems_5" + }, + "locked": { + "lastModified": 1769049374, + "narHash": "sha256-h0Os2qqNyycDY1FyZgtbn28VF1ySP74/n0f+LDd8j+w=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "b8f76bf5751835647538ef8784e4e6ee8deb8f95", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-25.11", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" + "ixx": "ixx", + "nixpkgs": [ + "hearth", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749730855, + "narHash": "sha256-L3x2nSlFkXkM6tQPLJP3oCBMIsRifhIDPMQQdHO5xWo=", + "owner": "NuschtOS", + "repo": "search", + "rev": "8dfe5879dd009ff4742b668d9c699bc4b9761742", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore", + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750779888, + "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "hearth": "hearth", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay_2" } }, "rust-overlay": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780629589, + "narHash": "sha256-oHysjxZdaEqkmyDpN8G1bl3V+r9uyRD1O66bH0bq0Cs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "7a5a1c0a5cb86a28224304309b68f050835fd1f6", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { "inputs": { "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1723429325, - "narHash": "sha256-4x/32xTCd+xCwFoI/kKSiCr5LQA2ZlyTRYXKEni5HR8=", + "lastModified": 1788456718, + "narHash": "sha256-TxHC0sBjV2pmsBLKAX02JTXlye/EOLt6Do+WNtGofGw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "65e3dc0fe079fe8df087cd38f1fe6836a0373aad", + "rev": "0b20a18e84d9164464739189c2b2a1b00f6f0e4b", "type": "github" }, "original": { @@ -61,6 +1114,27 @@ "type": "github" } }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764483358, + "narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "5aca6ff67264321d47856a2ed183729271107c9c", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -75,6 +1149,153 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "hearth", + "nixos-anywhere", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749194973, + "narHash": "sha256-eEy8cuS0mZ2j/r/FE0/LYBSBcIs/MKOIVakwHVuqTfk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "a05be418a1af1198ca0f63facb13c985db4cb3c5", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "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" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hearth", + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hearth", + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hearth", + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hearth", + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hearth", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hearth", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751300244, + "narHash": "sha256-PFuv1TZVYvQhha0ac53E3YgdtmLShrN0t4T6xqHl0jE=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "6115f3fdcb2c1a57b4a80a69f3c797e47607b90a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3252f2b..51e9b9d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,38 +1,28 @@ { + description = "Bevy controls library and examples"; + inputs = { 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 = { url = "github:oxalica/rust-overlay"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; + inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, flake-utils, rust-overlay }: - flake-utils.lib.eachDefaultSystem - (system: - let - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { - inherit system overlays; - }; - rustToolchain = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml); - nativeBuildInputs = with pkgs; [ rustToolchain pkg-config ]; - buildInputs = with pkgs; [ - openssl - shellcheck - file - ]; - in - with pkgs; - { - devShells.default = mkShell { - inherit buildInputs nativeBuildInputs; - }; - } - ); - + outputs = { self, hearth, ... }@inputs: + let + flake = builtins.warn "Using the `flake` variable may produce a large source closure." ./.; + lib = import ./lib { inherit inputs flake self; }; + in + hearth.lib.forAllSystemsWithPkgs lib.composedOverlays ({ system, pkgs }: { + legacyPackages.${system} = pkgs; + packages.${system} = import ./package { inherit self inputs flake pkgs; }; + devShells.${system} = import ./devshell { inherit self inputs flake pkgs; }; + }) // { + inherit lib; + }; } diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..6e57ee8 --- /dev/null +++ b/lib/default.nix @@ -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; +} diff --git a/package/bevy-controls/default.nix b/package/bevy-controls/default.nix new file mode 100644 index 0000000..963b007 --- /dev/null +++ b/package/bevy-controls/default.nix @@ -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" + ''; +} diff --git a/package/default.nix b/package/default.nix new file mode 100644 index 0000000..325d689 --- /dev/null +++ b/package/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: +{ + bevy-controls = import ./bevy-controls { inherit pkgs; }; + default = import ./bevy-controls { inherit pkgs; }; +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2b8fc40..0e9c6d7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] channel = '1.79.0' -components = ["rustfmt", "clippy"] +components = ["rustfmt", "clippy", "rust-src"]