initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
/.direnv
|
||||||
Generated
+5987
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "flappy-bird"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bevy = "0.19.0"
|
||||||
Generated
+80
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"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": 1782175435,
|
||||||
|
"narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "89570f24e97e614aa34aa9ab1c927b6578a43775",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1782443907,
|
||||||
|
"narHash": "sha256-P+pADLtK7qC1mz0/5Xq9uF77oahUR4zYLTaitiHsUHg=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "4b06ff4acf3491ff69721df852507fcc51d0a13d",
|
||||||
|
"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
|
||||||
|
}
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
rec {
|
||||||
|
description = "Rust Environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
rust-overlay,
|
||||||
|
}:
|
||||||
|
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
# =========================================================================================
|
||||||
|
# Define pkgs/stdenvs
|
||||||
|
# =========================================================================================
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [
|
||||||
|
rust-overlay.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# clangPkgs = import nixpkgs {
|
||||||
|
# inherit system;
|
||||||
|
# config.allowUnfree = true;
|
||||||
|
# overlays = [];
|
||||||
|
#
|
||||||
|
# # Use this to change the compiler:
|
||||||
|
# # - GCC: pkgs.stdenv
|
||||||
|
# # - Clang: pkgs.clangStdenv
|
||||||
|
# # NixOS packages are built using GCC by default. Using clang requires a full rebuild/redownload.
|
||||||
|
# config.replaceStdenv = {pkgs}: pkgs.clangStdenv;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Package set for cross-compilation
|
||||||
|
# windowsPkgs = import nixpkgs {
|
||||||
|
# inherit system;
|
||||||
|
# crossSystem = {
|
||||||
|
# config = "x86_64-w64-mingw32";
|
||||||
|
# };
|
||||||
|
# config.allowUnfree = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
inherit (pkgs) lib stdenv;
|
||||||
|
|
||||||
|
# =========================================================================================
|
||||||
|
# Define shell environment
|
||||||
|
# =========================================================================================
|
||||||
|
|
||||||
|
# Setup the shell when entering the "nix develop" environment (bash script).
|
||||||
|
shellHook = let
|
||||||
|
# Add project-local fish abbrs here
|
||||||
|
abbrs = {
|
||||||
|
# Rust Bevy:
|
||||||
|
build-release-windows = "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc";
|
||||||
|
};
|
||||||
|
|
||||||
|
eraseAbbr = name: value: ''abbr --erase ${name} 2>/dev/null'';
|
||||||
|
createAbbr = name: value: ''abbr -a ${name} "${value}"'';
|
||||||
|
|
||||||
|
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
|
||||||
|
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
|
||||||
|
echo "Unloading \"${description}\" environment..."
|
||||||
|
|
||||||
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
|
||||||
|
initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
|
||||||
|
# Unload just in case, to not have redefinition errors
|
||||||
|
source ${unloadProjectShell}
|
||||||
|
|
||||||
|
echo "Sourcing \"${description}\" environment..."
|
||||||
|
|
||||||
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
builtins.concatStringsSep "\n" [
|
||||||
|
# Launch into pure fish shell
|
||||||
|
''
|
||||||
|
# Determine the project root, used e.g. in cmake scripts
|
||||||
|
export FLAKE_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
# Can't do the "exec" with nix-direnv
|
||||||
|
# - The "exec fish" would call direnv again => Infinite loop
|
||||||
|
# - The shellHook is Bash/POSIX, so fish syntax doesn't work
|
||||||
|
|
||||||
|
# Use this for "nix develop" without direnv
|
||||||
|
# exec "$(type -p fish)" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
|
||||||
|
|
||||||
|
# Use this for direnv without "nix develop"
|
||||||
|
export INIT_PROJECT_SHELL="${initProjectShell}"
|
||||||
|
export UNLOAD_PROJECT_SHELL="${unloadProjectShell}"
|
||||||
|
''
|
||||||
|
|
||||||
|
# Qt: Launch into wrapped fish shell (direnv incompatible)
|
||||||
|
# https://nixos.org/manual/nixpkgs/stable/#sec-language-qt
|
||||||
|
# ''
|
||||||
|
# fishdir=$(mktemp -d)
|
||||||
|
# makeWrapper "$(type -p fish)" "$fishdir/fish" "''${qtWrapperArgs[@]}"
|
||||||
|
# exec "$fishdir/fish" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
|
||||||
|
# ''
|
||||||
|
];
|
||||||
|
|
||||||
|
# ===========================================================================================
|
||||||
|
# Define custom dependencies
|
||||||
|
# ===========================================================================================
|
||||||
|
|
||||||
|
rust = pkgs.rust-bin.stable.latest.default.override {
|
||||||
|
extensions = ["rust-src"]; # Include the Rust stdlib source (for IntelliJ)
|
||||||
|
targets = ["x86_64-unknown-linux-gnu" "x86_64-pc-windows-msvc"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ===========================================================================================
|
||||||
|
# Specify dependencies
|
||||||
|
# https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview
|
||||||
|
# Just for a "nix develop" shell, buildInputs can be used for everything.
|
||||||
|
# ===========================================================================================
|
||||||
|
|
||||||
|
# Add dependencies to nativeBuildInputs if they are executed during the build:
|
||||||
|
# - Those which are needed on $PATH during the build, for example cmake and pkg-config
|
||||||
|
# - Setup hooks, for example makeWrapper
|
||||||
|
# - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
rust
|
||||||
|
mold
|
||||||
|
cargo-expand
|
||||||
|
cargo-xwin
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
|
||||||
|
# - Libraries used by compilers, for example zlib
|
||||||
|
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
udev
|
||||||
|
alsa-lib
|
||||||
|
vulkan-loader
|
||||||
|
libxkbcommon
|
||||||
|
wayland
|
||||||
|
];
|
||||||
|
# ===========================================================================================
|
||||||
|
# Define buildable + installable packages
|
||||||
|
# ===========================================================================================
|
||||||
|
# package = stdenv.mkDerivation {
|
||||||
|
# inherit nativeBuildInputs buildInputs;
|
||||||
|
# pname = "";
|
||||||
|
# version = "1.0.0";
|
||||||
|
# src = ./.;
|
||||||
|
#
|
||||||
|
# installPhase = ''
|
||||||
|
# runHook preInstall
|
||||||
|
#
|
||||||
|
# mkdir -p $out/bin
|
||||||
|
# cp -rv ./${pname} $out/bin/
|
||||||
|
#
|
||||||
|
# runHook postInstall
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# windowsPackage = windowsPkgs.stdenv.mkDerivation rec {
|
||||||
|
# pname = "";
|
||||||
|
# version = "1.0.0";
|
||||||
|
# src = ./.;
|
||||||
|
#
|
||||||
|
# # nativeBuildInputs must be from the build-platform (not cross)
|
||||||
|
# # so we use "pkgs" here, not "windowsPkgs"
|
||||||
|
# nativeBuildInputs = with pkgs; [
|
||||||
|
# cmake
|
||||||
|
# ];
|
||||||
|
#
|
||||||
|
# buildInputs = with windowsPkgs; [];
|
||||||
|
#
|
||||||
|
# cmakeFlags = [
|
||||||
|
# "-DCMAKE_SYSTEM_NAME=Windows"
|
||||||
|
# ];
|
||||||
|
#
|
||||||
|
# installPhase = ''
|
||||||
|
# runHook preInstall
|
||||||
|
#
|
||||||
|
# mkdir -p $out/bin
|
||||||
|
# cp ./${pname}.exe $out/bin/
|
||||||
|
#
|
||||||
|
# runHook postInstall
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
in rec {
|
||||||
|
# Provide package for "nix build"
|
||||||
|
# packages = {
|
||||||
|
# default = package;
|
||||||
|
# windows = windowsPackage;
|
||||||
|
# };
|
||||||
|
# apps = {
|
||||||
|
# default = flake-utils.lib.mkApp {drv = package;};
|
||||||
|
# };
|
||||||
|
|
||||||
|
devShells = {
|
||||||
|
# Provide default environment for "nix develop".
|
||||||
|
# Other environments can be added below.
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inherit nativeBuildInputs buildInputs shellHook;
|
||||||
|
name = description;
|
||||||
|
|
||||||
|
# =========================================================================================
|
||||||
|
# Define environment variables
|
||||||
|
# =========================================================================================
|
||||||
|
|
||||||
|
# Rust stdlib source:
|
||||||
|
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
||||||
|
|
||||||
|
# Custom dynamic libraries:
|
||||||
|
# LD_LIBRARY_PATH = builtins.concatStringsSep ":" [
|
||||||
|
# # Rust Bevy GUI app:
|
||||||
|
# # "${pkgs.libx11}/lib"
|
||||||
|
# # "${pkgs.libxcursor}/lib"
|
||||||
|
# # "${pkgs.libxrandr}/lib"
|
||||||
|
# # "${pkgs.libxi}/lib"
|
||||||
|
# # "${pkgs.libGL}/lib"
|
||||||
|
#
|
||||||
|
# # JavaFX app:
|
||||||
|
# # "${pkgs.libGL}/lib"
|
||||||
|
# # "${pkgs.gtk3}/lib"
|
||||||
|
# # "${pkgs.glib.out}/lib"
|
||||||
|
# # "${pkgs.xorg.libXtst}/lib"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# Dynamic libraries from buildinputs:
|
||||||
|
LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
|
||||||
|
# QT imports to use with "qmlls -E"
|
||||||
|
# QML_IMPORT_PATH = "${pkgs.qt6.full}/lib/qt-6/qml";
|
||||||
|
|
||||||
|
# Set PYTHONPATH
|
||||||
|
# PYTHONPATH = ".";
|
||||||
|
|
||||||
|
# Set matplotlib backend
|
||||||
|
# MPLBACKEND = "TkAgg";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Provide environment with clang stdenv for "nix develop .#clang"
|
||||||
|
# clang =
|
||||||
|
# pkgs.mkShell.override {
|
||||||
|
# stdenv = pkgs.clangStdenv;
|
||||||
|
# } {
|
||||||
|
# inherit shellHook;
|
||||||
|
# name = description;
|
||||||
|
#
|
||||||
|
# # If not required, use pkgs instead of clangPkgs for a lighter build
|
||||||
|
# nativeBuildInputs = with pkgs; [];
|
||||||
|
# buildInputs = with pkgs; [];
|
||||||
|
#
|
||||||
|
# # =========================================================================================
|
||||||
|
# # Define environment variables
|
||||||
|
# # =========================================================================================
|
||||||
|
#
|
||||||
|
# # Dynamic libraries from buildinputs:
|
||||||
|
# LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user