Skip to content
Merged
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
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
# "-C", "target-cpu=native"]
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ lcov.info
*.profraw
*_git2_*
/.jj
/.direnv
# Symlink into Nix store after successful `nix build`:
/result
# For personal .envrc files
.envrc
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"jnoortheen.nix-ide",
"rust-lang.rust-analyzer",
"dnut.rewrap-revived"
]
}
23 changes: 13 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{
"files.readonlyInclude": {
"googleapis/**": true,
"target/**": true
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll": "explicit"
}
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"files.readonlyInclude": {
"googleapis/**": true,
"target/**": true
},
"rust-analyzer.rustfmt.extraArgs": ["+nightly"],
"rewrap.wrappingColumn": 100,
"rust-analyzer.cargo.buildScripts.enable": true,
"rewrap.wrappingColumn": 100
"rust-analyzer.rustfmt.extraArgs": ["+nightly"]
}
2 changes: 1 addition & 1 deletion crates/googleapis/include
Submodule include updated 3926 files
143 changes: 143 additions & 0 deletions flake.lock

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

90 changes: 90 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
description = "Google Cloud Firestore emulator with focus on stability";

inputs = {
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
naersk = {
url = "github:nix-community/naersk"; # For building rust crates as Nix derivations.
inputs.nixpkgs.follows = "nixpkgs";
};
# `self` refers to the copy of this git repository in the Nix Store. By setting
# `self.submodules` to `true`, we ensure the `googleapis` git submodule gets copied into the Nix
# store at the expected path.
self.submodules = true;
};

outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
naersk,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
# Initialize the naersk builder to use our specific toolchain:
rust-builder = pkgs.callPackage naersk {
cargo = rust-toolchain;
rustc = rust-toolchain;
};
# Packages necessary for building the firestore-emulator crate.
buildInputs = with pkgs; [
openssl
pkg-config
protobuf
];
in
{
# Define the development environment with the necessary dependencies and rust toolchain:
devShells.default = pkgs.mkShell {
# Made available in the shell's PATH.
inherit buildInputs;
name = "rust-shell";

# Other project dependencies to be made avaible in PATH:
packages = with pkgs; [
# Nix language server and formatter.
nixd
nixfmt-rfc-style
# Additional project dependencies.
just
cargo-tarpaulin
cargo-nextest
rustup
# Misc.
git
];
};

# Nix derivation for building the firestore-emulator using Naersk.
#
# `nix build` produces a symlink `./result` that points to the Nix store directory
# containing the built firestore-emulator binary under `./result/bin/firestore-emulator`
#
# Locally, `nix run . -- ARGS` runs the firestore-emulator binary with the provided
# arguments. For example: `nix run . -- --host-port 127.0.0.1:8080` to start the emulator on
# localhost.
#
# You can even run the emulator without manually doing a local checkout of this repository
# with `nix run github:skunkteam/rust-firestore-emulator -- ARGS`.
defaultPackage = rust-builder.buildPackage {
src = self;
# Naersk can't deal with `version = { workspace = true }` for the root package, so extract
# it manually:
version = with builtins; (fromTOML (readFile ./Cargo.toml)).workspace.package.version;
nativeBuildInputs = buildInputs;
};
}
);
}
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "1.90.0"
profile = "default" # Includes components: rustc, rust-std, cargo, rust-docs, rustfmt, and clippy.
components = ["rust-src", "rust-analyzer"] # Additional components.