This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
basic nix support, builds subkey and provides it to other packages #13713
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,83 @@ | ||
| # nix run github:paritytech/substrate#subkey | ||
| { | ||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; | ||
| rust-overlay = { | ||
| url = "github:oxalica/rust-overlay"; | ||
| inputs = { | ||
| nixpkgs.follows = "nixpkgs"; | ||
| flake-utils.follows = "flake-utils"; | ||
| }; | ||
| }; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
| outputs = { self, nixpkgs, flake-utils, rust-overlay }: | ||
| let | ||
| per_system = flake-utils.lib.eachDefaultSystem (system: | ||
| let | ||
| overlays = [ (import rust-overlay) ]; | ||
| pkgs = import nixpkgs { | ||
| inherit system overlays; | ||
| }; | ||
| rust-native-build-inputs = with pkgs; [ clang pkg-config ]; | ||
| rust-src = pkgs.lib.cleanSourceWith { | ||
| src = pkgs.lib.cleanSource ./.; | ||
| filter = pkgs.nix-gitignore.gitignoreFilterPure | ||
| (name: type: | ||
| ( | ||
| (type == "regular" && pkgs.lib.strings.hasSuffix ".nix" name) | ||
| == false | ||
| && | ||
| (type == "directory" && ".github" == name) == false | ||
| ) | ||
| ) | ||
| [ ./.gitignore ] ./.; | ||
| }; | ||
| rust-env = with pkgs; { | ||
| LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath [ | ||
| pkgs.stdenv.cc.cc.lib | ||
| pkgs.llvmPackages.libclang.lib | ||
| ]; | ||
| LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; | ||
| PROTOC = "${pkgs.protobuf}/bin/protoc"; | ||
| ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib"; | ||
| }; | ||
|
|
||
| darwin = pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [ | ||
| frameworks.Security | ||
| ]); | ||
|
|
||
| rust-libs = { | ||
| buildInputs = with pkgs; [ openssl ] ++ darwin; | ||
| nativeBuildInputs = rust-native-build-inputs; | ||
| doCheck = false; | ||
| }; | ||
| rust-deps = pkgs.makeRustPlatform { | ||
| inherit pkgs; | ||
| cargo = pkgs.rust-bin.beta.latest.default; | ||
| rustc = pkgs.rust-bin.beta.latest.default; | ||
| }; | ||
| subkey = with pkgs; rust-deps.buildRustPackage (rust-libs // rust-env // rec { | ||
| name = "subkey"; | ||
| src = rust-src; | ||
| cargoLock = { | ||
| lockFile = ./Cargo.lock; | ||
| }; | ||
| doCheck = false; | ||
| cargoBuildFlags = "--package ${name}"; | ||
| }); | ||
|
|
||
| in | ||
| { | ||
| packages = { | ||
| inherit subkey; | ||
| }; | ||
| } | ||
| ); | ||
| in | ||
| per_system // { | ||
| overlays = final: prev: { | ||
| subkey = per_system.packages.${prev.system}.subkey; | ||
| }; | ||
| }; | ||
| } | ||
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.
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.
stable works as well, and we could even use the rust toolchain from nixpkgs directly (that's what I use to build subkey on my computer).