-
Notifications
You must be signed in to change notification settings - Fork 0
Introduce nix flake #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Introduce nix flake #116
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
99e8381
Devshell works, but building the package not yet.
untio11 19d3eae
Got it working
untio11 51bc4ff
Shell is defined completely in the flake
untio11 0554279
Added comments, pin googleapis flake input
untio11 4292c52
This envrc file is not necessary, already included in parent
untio11 4768713
Better flake inputs
untio11 c115ad1
Confusing...
untio11 83ac7e8
Add nixd config
untio11 6d78c38
Update git submodule
untio11 a3e376f
Explicitely add cargo and clippy
untio11 22b596e
Actually update submodule
untio11 44cf425
Main review comments
untio11 6fbacea
Rewrap comment formatting and recommendation
untio11 ebdee93
Robuster nix build
untio11 9da87eb
Fix package version inlays in vscode
untio11 8b5044d
Get rid of direnv
untio11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| [build] | ||
| rustflags = ["--cfg", "tokio_unstable"] | ||
| # "-C", "target-cpu=native"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
| } | ||
Submodule include
updated
3926 files
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
pavadeli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| }; | ||
pavadeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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 | ||
pavadeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rustup | ||
pavadeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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; | ||
pavadeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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; | ||
| }; | ||
| } | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.