Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
fix(rust): cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
liketechnik committed May 16, 2024
1 parent 6c25032 commit 1476b67
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions rust/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
overlays = [ (final: prev: { ${packageName} = self.packages.${system}.${packageName}; }) ];
};

fenixPkgsFor = pkgs: fenix.packages.${pkgs.system};
fenixChannelFor =
pkgs:
(fenixPkgsFor pkgs).toolchainOf {
fenixPkgs = fenix.packages.${pkgs.system};
fenixChannel =
fenixPkgs.toolchainOf {
channel = "nightly";
date =
builtins.replaceStrings [ "nightly-" ] [ "" ]
Expand All @@ -48,10 +47,7 @@

toolchainFor =
pkgs:
let
fenix-pkgs = fenixPkgsFor pkgs;
in
with fenix-pkgs;
with fenixPkgs;
combine [
minimal.cargo
minimal.rustc
Expand Down Expand Up @@ -86,8 +82,8 @@
inherit
system
pkgs
fenixPkgsFor
fenixChannelFor
fenixPkgs
fenixChannel
toolchainFor
rustPlatformFor
crossPackageFor
Expand All @@ -101,21 +97,18 @@
packages = forSystems (
{
pkgs,
fenixChannelFor,
fenixChannel,
system,
crossPackageFor,
...
}:
let
fenix-channel = fenixChannelFor pkgs;
in
{
${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") {
inherit cargoMeta;
flake-self = self;
rustPlatform = pkgs.makeRustPlatform {
cargo = fenix-channel.toolchain;
rustc = fenix-channel.toolchain;
cargo = fenixChannel.toolchain;
rustc = fenixChannel.toolchain;
};
};
default = self.packages.${system}.${packageName};
Expand All @@ -128,10 +121,9 @@
);

devShells = forSystems (
{ pkgs, fenixChannelFor, ... }:
{ pkgs, fenixChannel, ... }:
let
fenix-channel = fenixChannelFor pkgs;
fenixRustToolchain = fenix-channel.withComponents [
fenixRustToolchain = fenixChannel.withComponents [
"cargo"
"clippy-preview"
"rust-src"
Expand Down

0 comments on commit 1476b67

Please sign in to comment.