Skip to content

Commit

Permalink
Merge pull request #6 from onekey-sec/rust-msrv-changes
Browse files Browse the repository at this point in the history
Rust version support changes
  • Loading branch information
vlaci authored May 8, 2023
2 parents 592a8af + 3fa922f commit de02d9a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 40 deletions.
79 changes: 56 additions & 23 deletions flake.lock

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

31 changes: 15 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
inputs.nixpkgs.follows = "nixpkgs";
};

fenix = {
url = "github:nix-community/fenix";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.rust-analyzer-src.follows = "";
};

flake-utils.url = "github:numtide/flake-utils";
Expand All @@ -25,23 +24,20 @@
};
};

outputs = { self, nixpkgs, nix-filter, crane, fenix, flake-utils, advisory-db, ... }:
outputs = { self, nixpkgs, nix-filter, crane, rust-overlay, flake-utils, advisory-db, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};

filter = nix-filter.lib;

inherit (pkgs) lib makeRustPlatform python3Packages;

channel = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain.channel;
rust-toolchain = fenix.packages.${system}.toolchainOf {
inherit channel;
sha256 = "sha256-otgm+7nEl94JG/B+TYhWseZsHV1voGcBsW/lOD2/68g=";
};
craneLib = crane.lib.${system}.overrideToolchain rust-toolchain.toolchain;
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = crane.lib.${system}.overrideToolchain rust-toolchain;
src = craneLib.cleanCargoSource (craneLib.path ./.);

# Common arguments can be set here to avoid repeating them later
Expand All @@ -61,11 +57,13 @@
};

craneLibLLvmTools = craneLib.overrideToolchain
(fenix.packages.${system}.complete.withComponents [
"cargo"
"llvm-tools"
"rustc"
]);
(rust-toolchain.override {
extensions = [
"cargo"
"llvm-tools-preview"
"rustc"
];
});

# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
Expand All @@ -78,7 +76,8 @@
});

rustPlatform = makeRustPlatform {
inherit (rust-toolchain) cargo rustc;
rustc = rust-toolchain;
cargo = rust-toolchain;
};

unblob-native = python3Packages.buildPythonPackage
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.60.0"
channel = "1.65.0"
profile = "default"

0 comments on commit de02d9a

Please sign in to comment.