Rust template

This commit is contained in:
Nox Sluijtman 2025-07-03 12:37:07 +02:00
parent 5f096772ba
commit 6156cbfe8b
Signed by: Egg
SSH key fingerprint: SHA256:2sG9X3C7Xvq2svGumz1/k7cm8l4G9+qAtAeugqB4J9M
6 changed files with 67 additions and 1 deletions

46
rust/flake.nix Normal file
View 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;
};
}
);
}