Rust template
This commit is contained in:
parent
5f096772ba
commit
6156cbfe8b
6 changed files with 67 additions and 1 deletions
2
crude/.gitignore
vendored
2
crude/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
|||
result
|
||||
.direnv
|
||||
.pdf
|
||||
*.pdf
|
||||
|
|
1
rust/.envrc
Normal file
1
rust/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
10
rust/.gitignore
vendored
Normal file
10
rust/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/target
|
||||
result
|
||||
/.direnv
|
||||
|
||||
|
||||
# Added by cargo
|
||||
#
|
||||
# already existing elements were commented out
|
||||
|
||||
#/target
|
6
rust/Cargo.toml
Normal file
6
rust/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "myapp"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
46
rust/flake.nix
Normal file
46
rust/flake.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
inputs = {
|
||||
naersk.url = "github:nix-community/naersk/master";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
naersk,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
naersk-lib = pkgs.callPackage naersk { };
|
||||
in
|
||||
{
|
||||
defaultPackage = naersk-lib.buildPackage {
|
||||
src = ./.;
|
||||
# nativeBuildInputs = with pkgs; [
|
||||
# ];
|
||||
# LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
|
||||
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
||||
};
|
||||
devShell =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
pre-commit
|
||||
rustPackages.clippy
|
||||
openssl
|
||||
pkg-config
|
||||
];
|
||||
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||
RUST_BACKTRACE = 1;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
3
rust/src/main.rs
Normal file
3
rust/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue