mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-21 18:40:19 +00:00
fix different toolchain channel between shells and packages
This commit is contained in:
parent
ae6fe9a7c1
commit
e271ca4293
3 changed files with 35 additions and 20 deletions
|
@ -81,11 +81,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682669017,
|
||||
"narHash": "sha256-Vi+p4y3wnl0/4gcwTdmCO398kKlDaUrNROtf3GOD2NY=",
|
||||
"lastModified": 1682817260,
|
||||
"narHash": "sha256-kFMXzKNj4d/0Iqbm5l57rHSLyUeyCLMuvlROZIuuhvk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7449971a3ecf857b4a554cf79b1d9dcc1a4647d8",
|
||||
"rev": "db1e4eeb0f9a9028bcb920e00abbc1409dd3ef36",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
22
flake.nix
22
flake.nix
|
@ -22,23 +22,12 @@
|
|||
let
|
||||
inherit (gitignore.lib) gitignoreSource;
|
||||
|
||||
mkToolchain = buildPlatform:
|
||||
fenix.packages.${buildPlatform}.minimal.toolchain;
|
||||
|
||||
mkToolchainWithTarget = buildPlatform: targetPlatform:
|
||||
with fenix.packages.${buildPlatform}; combine [
|
||||
stable.rustc
|
||||
stable.cargo
|
||||
targets.${targetPlatform}.stable.rust-std
|
||||
];
|
||||
mkToolchain = import ./rust-toolchain.nix fenix;
|
||||
|
||||
mkDevShells = buildPlatform:
|
||||
let
|
||||
pkgs = import nixpkgs { system = buildPlatform; };
|
||||
rust-toolchain = fenix.packages.${buildPlatform}.fromToolchainFile {
|
||||
file = ./rust-toolchain.toml;
|
||||
sha256 = "eMJethw5ZLrJHmoN2/l0bIyQjoTX1NsvalWSscTixpI=";
|
||||
};
|
||||
rust-toolchain = mkToolchain.fromFile { system = buildPlatform; };
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
|
@ -58,10 +47,9 @@
|
|||
|
||||
mkPackage = pkgs: buildPlatform: targetPlatform: package:
|
||||
let
|
||||
toolchain =
|
||||
if isNull targetPlatform
|
||||
then mkToolchain buildPlatform
|
||||
else mkToolchainWithTarget buildPlatform targetPlatform;
|
||||
toolchain = mkToolchain.fromTarget {
|
||||
inherit pkgs buildPlatform targetPlatform;
|
||||
};
|
||||
naersk' = naersk.lib.${buildPlatform}.override {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
|
|
27
rust-toolchain.nix
Normal file
27
rust-toolchain.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
fenix:
|
||||
|
||||
let
|
||||
file = ./rust-toolchain.toml;
|
||||
sha256 = "eMJethw5ZLrJHmoN2/l0bIyQjoTX1NsvalWSscTixpI=";
|
||||
in
|
||||
{
|
||||
fromFile = { system }: fenix.packages.${system}.fromToolchainFile {
|
||||
inherit file sha256;
|
||||
};
|
||||
|
||||
fromTarget = { pkgs, buildPlatform, targetPlatform ? null }:
|
||||
let
|
||||
inherit ((pkgs.lib.importTOML file).toolchain) channel;
|
||||
toolchain = fenix.packages.${buildPlatform};
|
||||
in
|
||||
if
|
||||
isNull targetPlatform
|
||||
then
|
||||
fenix.packages.${buildPlatform}.${channel}.toolchain
|
||||
else
|
||||
toolchain.combine [
|
||||
toolchain.${channel}.rustc
|
||||
toolchain.${channel}.cargo
|
||||
toolchain.targets.${targetPlatform}.${channel}.rust-std
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue