Compare commits
4 Commits
7b1c333bb4
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bb012b2ca9 | |||
| 20b8bcdb63 | |||
| 0ca3c9911a | |||
| d45aea4b70 |
@@ -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
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Rust build artifacts
|
||||
/target/
|
||||
Cargo.toml.orig
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*~
|
||||
|
||||
# Nix
|
||||
result
|
||||
result-*
|
||||
.direnv/
|
||||
|
||||
# Flatpak
|
||||
build-flatpak/
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -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
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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.
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "r_eom"
|
||||
version = "0.1.0"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "r_eom"
|
||||
description = "R_EoM library with a demo platform for testing and showcasing its features"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "CC-BY-SA-4.0"
|
||||
|
||||
[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,24 @@
|
||||
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
|
||||
|
||||
# Nix build target
|
||||
.PHONY: nix-build
|
||||
nix-build:
|
||||
nix build .#default
|
||||
@@ -1,2 +1,85 @@
|
||||
# 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
|
||||
```
|
||||
|
||||
### Nix
|
||||
|
||||
This project provides Nix support via flakes and a traditional `default.nix`.
|
||||
|
||||
To build the project using Nix:
|
||||
|
||||
```bash
|
||||
nix build
|
||||
```
|
||||
|
||||
To run the demo platform using Nix:
|
||||
|
||||
```bash
|
||||
nix run
|
||||
```
|
||||
|
||||
To enter a development shell:
|
||||
|
||||
```bash
|
||||
nix develop
|
||||
```
|
||||
|
||||
(or `nix-shell` for non-flake users)
|
||||
|
||||
### Flatpak
|
||||
|
||||
To build the Flatpak:
|
||||
|
||||
```bash
|
||||
make flatpak-build
|
||||
```
|
||||
|
||||
## IDE Support
|
||||
|
||||
### RustRover / IntelliJ Rust
|
||||
|
||||
This project includes shared run configurations in the `.run` directory. When you open the project in RustRover or IntelliJ IDEA with the Rust plugin, these configurations will automatically appear in the Run/Debug dropdown:
|
||||
|
||||
- **Run Demo**: Executes the `r_eom_demo` binary.
|
||||
- **Run Tests**: Executes all tests in the workspace.
|
||||
|
||||
Additionally, the IDE automatically detects all targets defined in `Cargo.toml`.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
|
||||
@@ -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.
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "r_eom";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "R_EoM library with a demo platform for testing and showcasing its features";
|
||||
license = licenses.cc-by-sa-40;
|
||||
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
|
||||
}
|
||||
@@ -126,13 +126,8 @@
|
||||
packages = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
{
|
||||
# Build the skeletal Cargo project
|
||||
default = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "sample-rust-app";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
};
|
||||
# Build the r_eom package
|
||||
default = pkgs.callPackage ./default.nix { };
|
||||
|
||||
devHelper = pkgs.writeShellScriptBin "dev-helper" ''
|
||||
echo "Rust toolchain available:"
|
||||
|
||||
@@ -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 = "CC-BY-SA-4.0"
|
||||
@@ -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