Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,21 @@ pub enum Gender {

## Nix

The prost project maintains flakes support for local development. Once you have
nix and nix flakes setup you can just run `nix develop` to get a shell
configured with the required dependencies to compile the whole project.
The prost project supports development using Nix flakes. Once you have Nix and flakes enabled, you can simply run:

```
nix develop
```

This will drop you into a shell with all dependencies configured to build the entire project.

If you want to use the minimum supported Rust version as required by Tokio [see MSRV](#msrv), run:

```
nix develop .#rust_minimum_version
```

This ensures compatibility testing and development with the oldest supported toolchain version.

## Feature Flags
- `std`: Enable integration with standard library. Disable this feature for `no_std` support. This feature is enabled by default.
Expand Down
68 changes: 67 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 43 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,53 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
rust_manifest = {
url = "https://static.rust-lang.org/dist/2023-08-03/channel-rust-1.71.1.toml";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
fenix,
rust_manifest,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
default_pkgs = with pkgs; [
protobuf
cmake
pkg-config
protobuf
curl
ninja
];
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [ cargo rustc ];
buildInputs = with pkgs; [ pkg-config protobuf curl cmake ninja ];
};
});
devShells.default =
let
rustpkgs = fenix.packages.${system}.stable.completeToolchain;
in
pkgs.mkShell {
packages = [
rustpkgs
] ++ default_pkgs;
};
devShells."rust_minimum_version" =
let
rustpkgs = (fenix.packages.${system}.fromManifestFile rust_manifest).completeToolchain;
in
pkgs.mkShell {
packages = [
rustpkgs
] ++ default_pkgs;
};
}
);
}
Loading
Loading