generated from ProcyOS/rust-template
Initial commit
This commit is contained in:
commit
f2e01c6ce0
17 changed files with 879 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/target
|
||||||
|
/.direnv
|
||||||
|
/result
|
||||||
|
/resul-bin
|
10
CHANGELOG.md
Normal file
10
CHANGELOG.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
[Unreleased]: https://git.chir.rs/ProcyOS/rust-template
|
78
CODE-OF-CONDUCT.md
Normal file
78
CODE-OF-CONDUCT.md
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
|
||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to make participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all project spaces, and it also applies when
|
||||||
|
an individual is representing the project or its community in public spaces.
|
||||||
|
Examples of representing a project or community include using an official
|
||||||
|
project e-mail address, posting via an official social media account, or acting
|
||||||
|
as an appointed representative at an online or offline event. Representation of
|
||||||
|
a project may be further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at trust@chir.rs. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
|
|
54
CONTRIBUTING.md
Normal file
54
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# Contributing to [Project]
|
||||||
|
|
||||||
|
Thank you for considering to contribute to our project!
|
||||||
|
|
||||||
|
There’s many ways you can help us:
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
|
||||||
|
Issues are very valuable both for reporting bugs and for gathering feedback on where the project is lacking. Before creating them, please try to find if someone else has already reported the issue, and upvote that instead.
|
||||||
|
|
||||||
|
## Pull Requests
|
||||||
|
|
||||||
|
Pull requests are always welcome! We'll do our best to review your pull request as soon as possible. Please make sure you follow these guidelines:
|
||||||
|
|
||||||
|
1. The pull request needs to make the intent of it clear.
|
||||||
|
|
||||||
|
GOOD: Allow `Component` to persist state.
|
||||||
|
|
||||||
|
BAD: Implement `Serialize` and `Deserialize` on `Component`
|
||||||
|
2. If it includes new code or fixes a bug, it should include tests. These do not need to be exhaustive.
|
||||||
|
3. Public APIs need to be documented.
|
||||||
|
4. The Pull Request needs to pass all CI tests.
|
||||||
|
5. Unless the change only affects documentation or tests, add a corresponding line to the [changelog](./CHANGELOG.md)
|
||||||
|
|
||||||
|
By creating a pull request on our repository, you agree to the [Developer Certificate of Origin](https://developercertificate.org/).
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
If you find parts of the documentation lacking, you are always welcome to extend or rewrite it.
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
We try to uncover issues in the code automatically before they are released. To facilitate this, we need plenty of tests. For this, tests that automatically test edge cases are welcome as well.
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
[TODO: We do not have a weblate]
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
You can also help by running prerelease versions and reporting bugs and issues with them.
|
||||||
|
|
||||||
|
## Assisting
|
||||||
|
|
||||||
|
You can also contribute by helping others in the chatrooms, or by posting blog articles about using the project.
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
Please follow the (Code of Conduct)[./CODE-OF-CONDUCT.md] in all correspondence with this project.
|
||||||
|
|
||||||
|
## Security Review
|
||||||
|
|
||||||
|
If you find a security issue, please look at our (Security Policy)[./SECURITY.md]
|
||||||
|
|
||||||
|
## Donations
|
||||||
|
|
||||||
|
You can donate money to the project maintainer here: https://ko-fi.com/darkkirb
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust-template"
|
||||||
|
version = "0.1.0"
|
70
Cargo.nix
Normal file
70
Cargo.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# This file was @generated by cargo2nix 0.11.0.
|
||||||
|
# It is not intended to be manually edited.
|
||||||
|
args @ {
|
||||||
|
release ? true,
|
||||||
|
rootFeatures ? [
|
||||||
|
"rust-template/default"
|
||||||
|
],
|
||||||
|
rustPackages,
|
||||||
|
buildRustPackages,
|
||||||
|
hostPlatform,
|
||||||
|
hostPlatformCpu ? null,
|
||||||
|
hostPlatformFeatures ? [],
|
||||||
|
target ? null,
|
||||||
|
codegenOpts ? null,
|
||||||
|
profileOpts ? null,
|
||||||
|
cargoUnstableFlags ? null,
|
||||||
|
rustcLinkFlags ? null,
|
||||||
|
rustcBuildFlags ? null,
|
||||||
|
mkRustCrate,
|
||||||
|
rustLib,
|
||||||
|
lib,
|
||||||
|
workspaceSrc,
|
||||||
|
ignoreLockHash,
|
||||||
|
}: let
|
||||||
|
nixifiedLockHash = "4598ab22b158163d169b6aea289131643ca58806898bb56966fba495f4660c02";
|
||||||
|
workspaceSrc =
|
||||||
|
if args.workspaceSrc == null
|
||||||
|
then ./.
|
||||||
|
else args.workspaceSrc;
|
||||||
|
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock);
|
||||||
|
lockHashIgnored =
|
||||||
|
if ignoreLockHash
|
||||||
|
then builtins.trace "Ignoring lock hash" ignoreLockHash
|
||||||
|
else ignoreLockHash;
|
||||||
|
in
|
||||||
|
if !lockHashIgnored && (nixifiedLockHash != currentLockHash)
|
||||||
|
then throw "Cargo.nix ${nixifiedLockHash} is out of sync with Cargo.lock ${currentLockHash}"
|
||||||
|
else let
|
||||||
|
inherit (rustLib) fetchCratesIo fetchCrateLocal fetchCrateGit fetchCrateAlternativeRegistry expandFeatures decideProfile genDrvsByProfile;
|
||||||
|
profilesByName = {
|
||||||
|
};
|
||||||
|
rootFeatures' = expandFeatures rootFeatures;
|
||||||
|
overridableMkRustCrate = f: let
|
||||||
|
drvs = genDrvsByProfile profilesByName ({
|
||||||
|
profile,
|
||||||
|
profileName,
|
||||||
|
}:
|
||||||
|
mkRustCrate ({inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts cargoUnstableFlags rustcLinkFlags rustcBuildFlags;} // (f profileName)));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
compileMode ? null,
|
||||||
|
profileName ? decideProfile compileMode release,
|
||||||
|
}: let
|
||||||
|
drv = drvs.${profileName};
|
||||||
|
in
|
||||||
|
if compileMode == null
|
||||||
|
then drv
|
||||||
|
else drv.override {inherit compileMode;};
|
||||||
|
in {
|
||||||
|
cargo2nixVersion = "0.11.0";
|
||||||
|
workspace = {
|
||||||
|
rust-template = rustPackages.unknown.rust-template."0.1.0";
|
||||||
|
};
|
||||||
|
"unknown".rust-template."0.1.0" = overridableMkRustCrate (profileName: rec {
|
||||||
|
name = "rust-template";
|
||||||
|
version = "0.1.0";
|
||||||
|
registry = "unknown";
|
||||||
|
src = fetchCrateLocal workspaceSrc;
|
||||||
|
});
|
||||||
|
}
|
66
Cargo.toml
Normal file
66
Cargo.toml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
[package]
|
||||||
|
name = "rust-template"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
authors = ["Charlotte 🦝 Delenk <lotte@chir.rs>"]
|
||||||
|
description = "Template for rust libraries"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
repository = "https://git.chir.rs/ProcyOS/rust-template"
|
||||||
|
keywords = ["template"]
|
||||||
|
categories = ["template"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
deprecated-safe = "forbid"
|
||||||
|
elided_lifetimes_in_paths = "warn"
|
||||||
|
explicit_outlives_requirements = "warn"
|
||||||
|
impl-trait-overcaptures = "warn"
|
||||||
|
keyword-idents-2024 = "forbid"
|
||||||
|
let-underscore-drop = "warn"
|
||||||
|
macro-use-extern-crate = "deny"
|
||||||
|
meta-variable-misuse = "deny"
|
||||||
|
missing-abi = "forbid"
|
||||||
|
missing-copy-implementations = "warn"
|
||||||
|
missing-debug-implementations = "deny"
|
||||||
|
missing-docs = "warn"
|
||||||
|
missing-unsafe-on-extern = "deny"
|
||||||
|
non-local-definitions = "warn"
|
||||||
|
redundant-lifetimes = "warn"
|
||||||
|
single-use-lifetimes = "warn"
|
||||||
|
trivial-casts = "warn"
|
||||||
|
trivial-numeric-casts = "warn"
|
||||||
|
unit-bindings = "deny"
|
||||||
|
unnameable-types = "warn"
|
||||||
|
unreachable-pub = "warn"
|
||||||
|
unsafe-code = "deny"
|
||||||
|
unsafe-op-in-unsafe-fn = "warn"
|
||||||
|
unused-crate-dependencies = "warn"
|
||||||
|
unused-extern-crates = "warn"
|
||||||
|
unused-import-braces = "warn"
|
||||||
|
unused-lifetimes = "warn"
|
||||||
|
unused-macro-rules = "warn"
|
||||||
|
unused-qualifications = "warn"
|
||||||
|
variant-size-differences = "warn"
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
cargo = { level = "warn", priority = -1 }
|
||||||
|
nursery = { level = "warn", priority = -1 }
|
||||||
|
pedantic = { level = "warn", priority = -1 }
|
||||||
|
module-name-repetitions = "allow"
|
||||||
|
alloc-instead-of-core = "warn"
|
||||||
|
allow-attributes-without-reason = "deny"
|
||||||
|
assertions-on-result-states = "forbid"
|
||||||
|
clone-on-ref-ptr = "warn"
|
||||||
|
empty-drop = "warn"
|
||||||
|
expect-used = "deny"
|
||||||
|
inline-asm-x86-att-syntax = "forbid"
|
||||||
|
missing-docs-in-private-items = "warn"
|
||||||
|
panic = "deny"
|
||||||
|
panic-in-result-fn = "forbid"
|
||||||
|
rc-buffer = "warn"
|
||||||
|
rc-mutex = "deny"
|
||||||
|
std-instead-of-alloc = "warn"
|
||||||
|
std-instead-of-core = "warn"
|
||||||
|
undocumented-unsafe-blocks = "deny"
|
||||||
|
unwrap-used = "forbid"
|
202
LICENSE-APACHE
Normal file
202
LICENSE-APACHE
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2024 Charlotte 🦝 Delenk
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
9
LICENSE-MIT
Normal file
9
LICENSE-MIT
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
Copyright 2024 Charlotte 🦝 Delenk
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
98
README.md
Normal file
98
README.md
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
# Project Title
|
||||||
|
|
||||||
|
One Paragraph of the project description
|
||||||
|
|
||||||
|
Initially appeared on
|
||||||
|
[gist](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2). But the page cannot open anymore so that is why I have moved it here.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
These instructions will give you a copy of the project up and running on
|
||||||
|
your local machine for development and testing purposes. See deployment
|
||||||
|
for notes on deploying the project on a live system.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
Requirements for the software and other tools to build, test and push
|
||||||
|
- [Example 1](https://www.example.com)
|
||||||
|
- [Example 2](https://www.example.com)
|
||||||
|
|
||||||
|
### Installing
|
||||||
|
|
||||||
|
A step by step series of examples that tell you how to get a development
|
||||||
|
environment running
|
||||||
|
|
||||||
|
Say what the step will be
|
||||||
|
|
||||||
|
Give the example
|
||||||
|
|
||||||
|
And repeat
|
||||||
|
|
||||||
|
until finished
|
||||||
|
|
||||||
|
End with an example of getting some data out of the system or using it
|
||||||
|
for a little demo
|
||||||
|
|
||||||
|
## Running the tests
|
||||||
|
|
||||||
|
Explain how to run the automated tests for this system
|
||||||
|
|
||||||
|
### Sample Tests
|
||||||
|
|
||||||
|
Explain what these tests test and why
|
||||||
|
|
||||||
|
Give an example
|
||||||
|
|
||||||
|
### Style test
|
||||||
|
|
||||||
|
Checks if the best practices and the right coding style has been used.
|
||||||
|
|
||||||
|
Give an example
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
Add additional notes to deploy this on a live system
|
||||||
|
|
||||||
|
## Built With
|
||||||
|
|
||||||
|
- [Contributor Covenant](https://www.contributor-covenant.org/) - Used
|
||||||
|
for the Code of Conduct
|
||||||
|
- [Creative Commons](https://creativecommons.org/) - Used to choose
|
||||||
|
the license
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code
|
||||||
|
of conduct, and the process for submitting pull requests to us.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
We use [Semantic Versioning](http://semver.org/) for versioning. For the versions
|
||||||
|
available, see the [tags on this
|
||||||
|
repository](https://github.com/PurpleBooth/a-good-readme-template/tags).
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
- **Billie Thompson** - *Provided README Template* -
|
||||||
|
[PurpleBooth](https://github.com/PurpleBooth)
|
||||||
|
|
||||||
|
See also the list of
|
||||||
|
[contributors](https://github.com/PurpleBooth/a-good-readme-template/contributors)
|
||||||
|
who participated in this project.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Licensed under either of
|
||||||
|
|
||||||
|
* Apache License, Version 2.0
|
||||||
|
[LICENSE-APACHE](LICENSE-APACHE)
|
||||||
|
* MIT license
|
||||||
|
[LICENSE-MIT](LICENSE-MIT)
|
||||||
|
|
||||||
|
at your option.
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
- Hat tip to anyone whose code is used
|
||||||
|
- Inspiration
|
||||||
|
- etc
|
23
SECURITY.md
Normal file
23
SECURITY.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Reporting a Vulnerability
|
||||||
|
|
||||||
|
To report a security issue, please contact me via E-Mail (security@chir.rs) or Matrix (@lotte:chir.rs) with either a standard bug report, or by pointing at the vulnerable code.
|
||||||
|
|
||||||
|
A proof of concept is appreciated, but not required. Please be available for further questions.
|
||||||
|
|
||||||
|
This project follows a 90 day disclosure policy. You can publically disclose the issue after 90 days, or when we disclose it ourselves.
|
||||||
|
|
||||||
|
## Security Hall of Fame
|
||||||
|
|
||||||
|
1. and you?
|
||||||
|
|
||||||
|
## Threat Model
|
||||||
|
|
||||||
|
[Insert as appropriate]
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
We do not consider tests to be in scope for security vulnerabilities. If you think a test is missing, feel free to [contribute](./CONTRIBUTING.md) it.
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
We support the latest released version, as well as the most recent development versions. If the vulnerability only affects an older version with still sees some use (for example the previous major version), we may consider supporting it on a “best effort” basis.
|
15
default.nix
Normal file
15
default.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
(
|
||||||
|
import
|
||||||
|
(
|
||||||
|
let
|
||||||
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
in
|
||||||
|
fetchTarball {
|
||||||
|
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{src = ./.;}
|
||||||
|
)
|
||||||
|
.defaultNix
|
||||||
|
.hydraJobs
|
141
flake.lock
Normal file
141
flake.lock
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"cargo2nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-overlay": [
|
||||||
|
"rust-overlay"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1713199118,
|
||||||
|
"narHash": "sha256-MlLdAvk+zXCFUy280sY6LqtykqWXIkKVXo72J7a6HlU=",
|
||||||
|
"owner": "cargo2nix",
|
||||||
|
"repo": "cargo2nix",
|
||||||
|
"rev": "1efb03f2f794ad5eed17e807e858c4da001dbc3e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cargo2nix",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "cargo2nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"revCount": 57,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1725342129,
|
||||||
|
"narHash": "sha256-vpiCGl5MzAoQejRAvucwIQjBoJHBthwfRkB3PG0LuE0=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c78e599b85a534a09e2991ae367a6804ffeeb18f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"cargo2nix": "cargo2nix",
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1725330199,
|
||||||
|
"narHash": "sha256-oUkdPJIxP3r3YyVOBLkDVLIJiQV9YlrVqA+jNcdpCvM=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "a562172c72d00350f9f2ff830e6515b6e7bee6d5",
|
||||||
|
"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
|
||||||
|
}
|
72
flake.nix
Normal file
72
flake.nix
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
description = "rust-template";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = github:NixOS/nixpkgs;
|
||||||
|
flake-utils.url = github:numtide/flake-utils;
|
||||||
|
|
||||||
|
rust-overlay = {
|
||||||
|
url = github:oxalica/rust-overlay;
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargo2nix = {
|
||||||
|
url = github:cargo2nix/cargo2nix/main;
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
|
inputs.rust-overlay.follows = "rust-overlay";
|
||||||
|
};
|
||||||
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
rust-overlay,
|
||||||
|
cargo2nix,
|
||||||
|
...
|
||||||
|
} @ inputs:
|
||||||
|
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
|
||||||
|
overlays = [
|
||||||
|
cargo2nix.overlays.default
|
||||||
|
(import rust-overlay)
|
||||||
|
];
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system overlays;
|
||||||
|
};
|
||||||
|
rustPkgs = pkgs.rustBuilder.makePackageSet {
|
||||||
|
packageFun = import ./Cargo.nix;
|
||||||
|
rustChannel = "nightly";
|
||||||
|
rustVersion = "latest";
|
||||||
|
packageOverrides = pkgs: pkgs.rustBuilder.overrides.all;
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
devShells.default = with pkgs;
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
(rust-bin.nightly.latest.default.override {
|
||||||
|
extensions = ["rust-src"];
|
||||||
|
})
|
||||||
|
cargo2nix.packages.${system}.cargo2nix
|
||||||
|
llvmPackages_19.bintools
|
||||||
|
rustfilt
|
||||||
|
openssl
|
||||||
|
pkg-config
|
||||||
|
gdb
|
||||||
|
];
|
||||||
|
};
|
||||||
|
packages = pkgs.lib.mapAttrs (_: v: v {}) rustPkgs.workspace;
|
||||||
|
nixosModules.default = import ./nixos {
|
||||||
|
inherit inputs system;
|
||||||
|
};
|
||||||
|
checks = pkgs.lib.mapAttrs (_: v: pkgs.rustBuilder.runTests v {}) rustPkgs.workspace;
|
||||||
|
hydraJobs = {
|
||||||
|
inherit packages checks;
|
||||||
|
};
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
# Trick renovate into working: "github:NixOS/nixpkgs/nixpkgs-unstable"
|
||||||
|
|
15
renovate.json
Normal file
15
renovate.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"config:best-practices"
|
||||||
|
],
|
||||||
|
"postUpgradeTasks": {
|
||||||
|
"commands": [
|
||||||
|
"cargo2nix -o",
|
||||||
|
"alejandra ."
|
||||||
|
],
|
||||||
|
"fileFilters": [
|
||||||
|
"Cargo.toml",
|
||||||
|
"Cargo.lock"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
14
src/lib.rs
Normal file
14
src/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
pub fn add(left: u64, right: u64) -> u64 {
|
||||||
|
left + right
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
let result = add(2, 2);
|
||||||
|
assert_eq!(result, 4);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue