mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50: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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682669017,
|
"lastModified": 1682817260,
|
||||||
"narHash": "sha256-Vi+p4y3wnl0/4gcwTdmCO398kKlDaUrNROtf3GOD2NY=",
|
"narHash": "sha256-kFMXzKNj4d/0Iqbm5l57rHSLyUeyCLMuvlROZIuuhvk=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7449971a3ecf857b4a554cf79b1d9dcc1a4647d8",
|
"rev": "db1e4eeb0f9a9028bcb920e00abbc1409dd3ef36",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
22
flake.nix
22
flake.nix
|
@ -22,23 +22,12 @@
|
||||||
let
|
let
|
||||||
inherit (gitignore.lib) gitignoreSource;
|
inherit (gitignore.lib) gitignoreSource;
|
||||||
|
|
||||||
mkToolchain = buildPlatform:
|
mkToolchain = import ./rust-toolchain.nix fenix;
|
||||||
fenix.packages.${buildPlatform}.minimal.toolchain;
|
|
||||||
|
|
||||||
mkToolchainWithTarget = buildPlatform: targetPlatform:
|
|
||||||
with fenix.packages.${buildPlatform}; combine [
|
|
||||||
stable.rustc
|
|
||||||
stable.cargo
|
|
||||||
targets.${targetPlatform}.stable.rust-std
|
|
||||||
];
|
|
||||||
|
|
||||||
mkDevShells = buildPlatform:
|
mkDevShells = buildPlatform:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
pkgs = import nixpkgs { system = buildPlatform; };
|
||||||
rust-toolchain = fenix.packages.${buildPlatform}.fromToolchainFile {
|
rust-toolchain = mkToolchain.fromFile { system = buildPlatform; };
|
||||||
file = ./rust-toolchain.toml;
|
|
||||||
sha256 = "eMJethw5ZLrJHmoN2/l0bIyQjoTX1NsvalWSscTixpI=";
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
|
@ -58,10 +47,9 @@
|
||||||
|
|
||||||
mkPackage = pkgs: buildPlatform: targetPlatform: package:
|
mkPackage = pkgs: buildPlatform: targetPlatform: package:
|
||||||
let
|
let
|
||||||
toolchain =
|
toolchain = mkToolchain.fromTarget {
|
||||||
if isNull targetPlatform
|
inherit pkgs buildPlatform targetPlatform;
|
||||||
then mkToolchain buildPlatform
|
};
|
||||||
else mkToolchainWithTarget buildPlatform targetPlatform;
|
|
||||||
naersk' = naersk.lib.${buildPlatform}.override {
|
naersk' = naersk.lib.${buildPlatform}.override {
|
||||||
cargo = toolchain;
|
cargo = toolchain;
|
||||||
rustc = 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