diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9a5fb15 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "game_kt" +version = "0.0.1" +edition = "2024" +description = "A console logging library for Rust applications" +license = "MIT" +publish = ["gitea"] +autobins = false + +[lib] +name = "game_kt" +path = "src/lib.rs" + diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2f3c686 --- /dev/null +++ b/flake.nix @@ -0,0 +1,122 @@ +{ + description = "Rust development environment for the game_kt console logging library"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + inputs@{ self, ... }: + let + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSupportedSystem = + f: + inputs.nixpkgs.lib.genAttrs supportedSystems ( + system: + f { + pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + inputs.self.overlays.default + ]; + }; + } + ); + in + { + templates = { + default = { + path = ./.; + description = "Rust library development environment using fenix"; + }; + }; + + overlays.default = _final: prev: { + rustToolchain = + with inputs.fenix.packages.${prev.stdenv.hostPlatform.system}; + combine ( + with stable; + [ + cargo + clippy + rustc + rustfmt + rust-src + ] + ); + }; + + devShells = forEachSupportedSystem ( + { pkgs }: + { + default = pkgs.mkShell { + packages = with pkgs; [ + rustToolchain + git + gnumake + alejandra + statix + deadnix + openssl + pkg-config + cargo-deny + cargo-edit + cargo-watch + rust-analyzer + pre-commit + ]; + + env = { + RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; + }; + + shellHook = '' + if [ ! -d .git ]; then + git init + echo "✓ Initialized git repository" + fi + + export PATH="$HOME/.cargo/bin:$PATH" + + echo "[game_kt] Welcome to the Rust library development shell!" + echo "Tools: cargo, rustc, clippy, rustfmt, rust-analyzer" + echo "Run 'cargo test', 'cargo clippy', or 'cargo build' to work on the library." + ''; + }; + } + ); + + packages = forEachSupportedSystem ( + { pkgs }: + { + default = pkgs.rustPlatform.buildRustPackage { + pname = "game_kt"; + version = "0.1.0"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + }; + } + ); + + checks = forEachSupportedSystem ( + { pkgs }: + { + default = self.packages.${pkgs.stdenv.hostPlatform.system}.default; + } + ); + + formatter = forEachSupportedSystem ( + { pkgs }: + pkgs.alejandra + ); + }; +} \ No newline at end of file