Starting Project
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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.
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "r_eom"
|
||||
description = "R_EoM library with a demo platform for testing and showcasing its features"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "r_eom"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "r_eom_demo"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,17 @@
|
||||
Creative Commons Attribution-ShareAlike 4.0 International
|
||||
|
||||
<https://creativecommons.org/licenses/by-sa/4.0/>
|
||||
|
||||
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.
|
||||
@@ -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
|
||||
@@ -1,2 +1,46 @@
|
||||
# R_EoM
|
||||
|
||||
R_EoM is a library with a demo platform for testing and showcasing its features.
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/lib.rs`: The core library logic.
|
||||
- `src/main.rs`: The demo platform application.
|
||||
- `tests/`: Integration tests.
|
||||
- `flatpak/`: Flatpak manifest for the demo platform.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Rust and Cargo
|
||||
- (Optional) Flatpak and Flatpak Builder
|
||||
|
||||
### Building and Running
|
||||
|
||||
To build the project:
|
||||
|
||||
```bash
|
||||
cargo build
|
||||
```
|
||||
|
||||
To run the demo platform:
|
||||
|
||||
```bash
|
||||
cargo run --bin r_eom_demo
|
||||
```
|
||||
|
||||
To run tests:
|
||||
|
||||
```bash
|
||||
cargo test
|
||||
```
|
||||
|
||||
### Flatpak
|
||||
|
||||
To build the Flatpak:
|
||||
|
||||
```bash
|
||||
make flatpak-build
|
||||
```
|
||||
|
||||
|
||||
@@ -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.
|
||||
+29
@@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Generated
+66
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"nodes": {
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1784017020,
|
||||
"narHash": "sha256-49WO85egjNtN1vMgJ3zUjDh5IqO+ou4zZY80WQ6EKGg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "fa2a0be0f712d7147d1677d33d15ea7b0589cdb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1784007870,
|
||||
"narHash": "sha256-djcLt/JJphyNt4eDY9XTly+/WbCK5lqWq9lSgCmJkkQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "18b9261cb3294b6d2a06d03f96872827b8fe2698",
|
||||
"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": 1783975201,
|
||||
"narHash": "sha256-oyHWTfKWk06nTynCO8ByEAx/KEARvOOyTVnwinOmK3Q=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "63a6f0d4bcfd3bbcf36383fcbcbcd93456ed1653",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"app-id": "org.reom.Demo",
|
||||
"runtime": "org.freedesktop.Platform",
|
||||
"runtime-version": "23.08",
|
||||
"sdk": "org.freedesktop.Sdk",
|
||||
"command": "r_eom_demo",
|
||||
"modules": [
|
||||
{
|
||||
"name": "r_eom",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"cargo build --release"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"path": ".."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
[project]
|
||||
name = "r_eom"
|
||||
description = "R_EoM library with a demo platform for testing and showcasing its features"
|
||||
version = "0.1.0"
|
||||
authors = ["gooba42 <your@email>"]
|
||||
license = "MIT"
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
}:
|
||||
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."
|
||||
'';
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//! R_EoM library
|
||||
//!
|
||||
//! This library provides the core logic for the R_EoM project.
|
||||
|
||||
/// Returns a greeting message from the R_EoM library.
|
||||
pub fn greeting() -> String {
|
||||
"Hello from the R_EoM library!".to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_greeting() {
|
||||
assert_eq!(greeting(), "Hello from the R_EoM library!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use r_eom;
|
||||
|
||||
fn main() {
|
||||
println!("R_EoM Demo Platform");
|
||||
println!("-------------------");
|
||||
println!("{}", r_eom::greeting());
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
use r_eom;
|
||||
|
||||
#[test]
|
||||
fn test_library_greeting() {
|
||||
assert_eq!(r_eom::greeting(), "Hello from the R_EoM library!");
|
||||
}
|
||||
Reference in New Issue
Block a user