feat(rust): initialised cargo

This commit is contained in:
Artur Manuel 2024-08-06 23:45:54 +01:00
commit 900a9b8e42
Failed to generate hash of commit
9 changed files with 121 additions and 0 deletions

22
nix/package.nix Normal file
View file

@ -0,0 +1,22 @@
{
lib,
rustPlatform,
stdenvAdapters,
llvm,
}: let
toml = (lib.importTOML ../Cargo.toml).package;
pname = toml.name;
inherit (toml) version;
in
rustPlatform.buildRustPackage.override {stdenv = stdenvAdapters.useMoldLinker llvm.stdenv;} {
RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
inherit pname version;
src = builtins.path {
name = "${pname}-${version}";
path = lib.sources.cleanSource ../.;
};
cargoLock.lockFile = ../Cargo.lock;
}

25
nix/shell.nix Normal file
View file

@ -0,0 +1,25 @@
{
mkShell,
rust-analyzer-unwrapped,
rustfmt,
clippy,
cargo,
rustc,
gcc,
rustPlatform,
}:
mkShell {
strictDeps = true;
nativeBuildInputs = [
cargo
rustc
gcc
rust-analyzer-unwrapped
rustfmt
clippy
];
env.RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
}