chore: examples simple way

This commit is contained in:
2024-02-06 16:40:00 +01:00
parent ed98651cfc
commit 7cf7d4fe7d
8 changed files with 469 additions and 417 deletions
+5
View File
@@ -24,3 +24,8 @@ strum_macros = "0.25.3"
[dev-dependencies]
env_logger = "0.10.1"
[[example]]
name = "basic"
path = "example/basic/src/main.rs"
doc-scrape-examples = true
@@ -0,0 +1,8 @@
[package]
name = "basic"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+36
View File
@@ -0,0 +1,36 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
nativeBuildInputs = with pkgs; [ rustToolchain pkg-config ];
buildInputs = with pkgs; [
openssl
];
in
with pkgs;
{
devShells.default = mkShell {
inherit buildInputs nativeBuildInputs;
};
}
);
}