-
Notifications
You must be signed in to change notification settings - Fork 42
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
build(nix): Use crane to cache cargo dependencies #121
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
94b3474
Add crane
justinrubek 127bd98
switch rust toolchain to come from fenix
justinrubek 2934abd
touch buildscript before executing cargo build
justinrubek c8e71c4
add clippy and build checks
justinrubek 8bce68f
rename arrowstore build script
justinrubek f23c9b9
Merge branch 'main' into crane
justinrubek 0b1079f
rename raft build script
justinrubek 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 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
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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 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,22 +1,35 @@ | ||
{ | ||
inputs, | ||
self, | ||
lib, | ||
... | ||
}: let | ||
inherit (inputs.gitignore.lib) gitignoreSource; | ||
in { | ||
flake.lib = { | ||
flake_source = gitignoreSource ../..; | ||
cargo_lock = ../../Cargo.lock; | ||
rust-stable = system: inputs.rust-overlay.packages.${system}.rust; | ||
rust-nightly = system: inputs.rust-overlay.packages.${system}.rust-nightly; | ||
|
||
otherNativeBuildInputs = pkgs: with pkgs; [pkgconfig openssl openssl.dev llvmPackages.bintools llvmPackages.libclang]; | ||
otherBuildInputs = pkgs: | ||
with pkgs; [ | ||
clang | ||
openssl | ||
protobuf | ||
]; | ||
|
||
# Filters for files to include in nix store | ||
filterProto = orig_path: type: | ||
let | ||
path = (toString orig_path); | ||
base = baseNameOf path; | ||
|
||
matchesSuffix = lib.any (suffix: lib.hasSuffix suffix base) [ | ||
# Include all proto files | ||
".proto" | ||
]; | ||
in | ||
type == "directory" || matchesSuffix; | ||
|
||
filterSrc = craneLib: orig_path: type: | ||
(self.lib.filterProto orig_path type) || (craneLib.filterCargoSources orig_path type); | ||
|
||
}; | ||
} |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, what does the fenix version get us that the other one doesn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were using rust-overlay before, but weren't using it as an overlay. In nix an overlay basically adds/overrides packages from nixpkgs. Instead of applying that I had looked at the flake outputs from it and saw the overlay flake exported a package with the toolchain, but they don't make any guarantee's on the stability of any outputs but the overlay as that is the purpose of the flake.
Fenix is designed specifically for getting the toolchain without mucking around with overlays. According to their readme the goal is to be a replacement for rustup. It also works particularly well with crane as we can pass a fenix toolchain directly to crane