1{ lib, rustPlatform }: let
2 toml = (lib.importTOML ./Cargo.toml).package;
3in rustPlatform.buildRustPackage {
4 pname = "example-rust";
5 inherit (toml) version;
6
7 src = lib.fileset.toSource {
8 root = ./.;
9 fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./.)) (
10 lib.fileset.unions [
11 ./Cargo.toml
12 ./Cargo.lock
13 ./src
14 ]
15 );
16 };
17
18 cargoLock.lockFile = ./Cargo.lock;
19
20 meta = {
21 inherit (toml) homepage description;
22 };
23}