From 45605478f8c636d313182243d612829d54e9b4c6 Mon Sep 17 00:00:00 2001 From: Kyle J Turpin Date: Fri, 28 Aug 2026 14:48:27 -0500 Subject: [PATCH] Initial commit --- .direnv/flake-profile | 1 + .direnv/flake-profile-2-link | 1 + .editorconfig | 9 +++ .envrc | 2 + .idea/GitLink.xml | 6 ++ .idea/game-kt.iml | 12 ++++ .idea/inspectionProfiles/Project_Default.xml | 13 ++++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ .pre-commit-config.yaml | 8 +++ CONTRIBUTING.md | 9 +++ Cargo.lock | 7 +++ LICENSE | 17 +++++ Makefile | 19 ++++++ agents.md | 16 +++++ default.nix | 29 +++++++++ flake.lock | 66 ++++++++++++++++++++ flatpak/app.flatpak.json | 22 +++++++ project.toml | 6 ++ shell.nix | 15 +++++ src/lib.rs | 0 tests/sample_test.rs | 4 ++ 22 files changed, 276 insertions(+) create mode 120000 .direnv/flake-profile create mode 120000 .direnv/flake-profile-2-link create mode 100644 .editorconfig create mode 100644 .envrc create mode 100644 .idea/GitLink.xml create mode 100644 .idea/game-kt.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md create mode 100644 Cargo.lock create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 agents.md create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flatpak/app.flatpak.json create mode 100644 project.toml create mode 100644 shell.nix create mode 100644 src/lib.rs create mode 100644 tests/sample_test.rs diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..c7ae5b7 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +flake-profile-2-link \ No newline at end of file diff --git a/.direnv/flake-profile-2-link b/.direnv/flake-profile-2-link new file mode 120000 index 0000000..51412a0 --- /dev/null +++ b/.direnv/flake-profile-2-link @@ -0,0 +1 @@ +/nix/store/nzs5pmy9n7c63z9bi62rl9qzkz7xbdpb-nix-shell-env \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f02fd20 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# EditorConfig for Rust template +root = false +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..ea35353 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +# Direnv configuration for Nix flakes +use flake \ No newline at end of file diff --git a/.idea/GitLink.xml b/.idea/GitLink.xml new file mode 100644 index 0000000..5143819 --- /dev/null +++ b/.idea/GitLink.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/game-kt.iml b/.idea/game-kt.iml new file mode 100644 index 0000000..bbe0a70 --- /dev/null +++ b/.idea/game-kt.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9213c29 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d613b0a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..93d696f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a94fcb9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +Thank you for considering contributing! + +- Please follow the project coding style and directory structure. +- Submit issues or pull requests for bugs, features, or improvements. +- Add tests for new features where possible. +- Ensure your code builds and passes tests before submitting. +- Contributions are licensed under CC BY-SA 4.0. diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..03f0bc5 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "game_kt" +version = "0.0.1" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eae17d3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +Creative Commons Attribution-ShareAlike 4.0 International + + + +You are free to: + +- Share — copy and redistribute the material in any medium or format +- Adapt — remix, transform, and build upon the material for any purpose, even commercially. + +Under the following terms: + +- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. +- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +See the full license at the link above. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..efd5f56 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +build: + cargo build + +run: + cargo run + +test: + cargo test + +clean: + cargo clean + +.PHONY: build run test clean + + +# Flatpak build target +.PHONY: flatpak-build +flatpak-build: + flatpak-builder --force-clean build-flatpak flatpak/app.flatpak.json diff --git a/agents.md b/agents.md new file mode 100644 index 0000000..1bb9395 --- /dev/null +++ b/agents.md @@ -0,0 +1,16 @@ +# Coding Agent Instructions + +This project is intended for educational purposes. To support this, please adhere to the following guidelines: + +## Allowed Actions +- **Environment Maintenance:** Feel free to update Nix flakes, shell configurations, or other environment-related setup. +- **Project Housekeeping:** Maintain a standard project layout, keep `README.md` up-to-date, and clean up temporary or build-related files. +- **Documentation:** Add comments, manage project documentation, and add links to relevant external resources. + +## Restricted Actions +- **Source Code Editing:** You are NOT allowed to edit the executable source code (`src/` directory) except to improve documentation.. +- **Code Generation:** Do not provide example code unless explicitly asked by the user. + +## Communication Guidelines +- **Educational Focus:** When asked about code, prioritize explaining the concepts and providing advice over writing code. +- **Documentation Links:** Always include links to official language or library documentation for references. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..9bfc4d3 --- /dev/null +++ b/default.nix @@ -0,0 +1,29 @@ +{ pkgs }: +let + lib = pkgs.lib; + templateName = builtins.baseNameOf (toString ./.); +in +{ + ${templateName} = pkgs.stdenvNoCC.mkDerivation { + pname = templateName; + version = "0.1.0"; + src = ./.; + dontBuild = true; + installPhase = '' + mkdir -p $out/share/${templateName} + if [ -d src ]; then + cp -r src $out/share/${templateName}/ + fi + for f in README.md project.toml flake.nix default.nix shell.nix Makefile .editorconfig .gitignore; do + if [ -f "$f" ]; then + cp "$f" $out/share/${templateName}/ + fi + done + ''; + meta = with lib; { + description = "Template project: ${templateName}"; + license = licenses.unfreeRedistributable; + platforms = platforms.all; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..52601ed --- /dev/null +++ b/flake.lock @@ -0,0 +1,66 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1787941560, + "narHash": "sha256-dMvXIG1IrbpolQY6+4u5lxqtPPQWVVNPGwSh9Vy6fIA=", + "owner": "nix-community", + "repo": "fenix", + "rev": "2810303efc016eb3dcf9d3176c65ac732409fdbf", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1787736819, + "narHash": "sha256-cV5xEJJK3BvhU8rEd4mC9UsmDi5qscv/kzGPhBRC5WA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9fbb54b33e91ee4ca368e35a78e0613c720600b3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1787768781, + "narHash": "sha256-PMVtb917DTWjGLTQHHI+ATUguk7Wxuqu6J+DINiU+qI=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "70d74f4d134c45b073c82167fb7e7d61334bd8f5", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flatpak/app.flatpak.json b/flatpak/app.flatpak.json new file mode 100644 index 0000000..c4e609c --- /dev/null +++ b/flatpak/app.flatpak.json @@ -0,0 +1,22 @@ +{ + "app-id": "org.example.rustdevshell", + "runtime": "org.freedesktop.Platform", + "runtime-version": "23.08", + "sdk": "org.freedesktop.Sdk", + "command": "rustdevshell-app", + "modules": [ + { + "name": "rustdevshell-app", + "buildsystem": "simple", + "build-commands": [ + "cargo build --release" + ], + "sources": [ + { + "type": "dir", + "path": ".." + } + ] + } + ] +} \ No newline at end of file diff --git a/project.toml b/project.toml new file mode 100644 index 0000000..47f6547 --- /dev/null +++ b/project.toml @@ -0,0 +1,6 @@ +[project] +name = "rust-template" +description = "A reusable Nix flake template for Rust development." +version = "0.1.0" +authors = ["gooba42 "] +license = "MIT" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c0c1627 --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +{ + pkgs ? import { }, +}: +pkgs.mkShell { + buildInputs = [ + pkgs.rustc + pkgs.cargo + pkgs.rustfmt + pkgs.clippy + pkgs.rust-analyzer + ]; + shellHook = '' + echo "[shell.nix] Legacy shell for Rust dev. Use 'nix develop' for full flake support." + ''; +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e69de29 diff --git a/tests/sample_test.rs b/tests/sample_test.rs new file mode 100644 index 0000000..7c050df --- /dev/null +++ b/tests/sample_test.rs @@ -0,0 +1,4 @@ +#[test] +fn test_sample() { + assert_eq!(1, 1); +}