diff --git a/README.md b/README.md index a9d50cbeb..650256050 100644 --- a/README.md +++ b/README.md @@ -452,6 +452,13 @@ 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. + + ## FAQ 1. **Could `prost` be implemented as a serializer for [Serde](https://serde.rs/)?** diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..5cb2e9ea6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1667969101, + "narHash": "sha256-GL53T705HO7Q/KVfbb5STx8AxFs8YgaGY8pvAZC+O7U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bbf77421ac51a7c93f5f0f760da99e4dbce614fa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..ac943ea47 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + description = "Prost dependencies"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ cargo rustc ]; + buildInputs = with pkgs; [ pkg-config protobuf curl ]; + }; + }); +}