Skip to content

Commit

Permalink
build(nix): rust-overlay -> fenix
Browse files Browse the repository at this point in the history
this fixes linking issues we're having with rust 1.80 and cross
compiling
  • Loading branch information
getchoo committed Aug 7, 2024
1 parent 8237e5e commit d34b7f7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 32 deletions.
43 changes: 22 additions & 21 deletions flake.lock

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

13 changes: 8 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

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

treefmt-nix = {
Expand All @@ -19,7 +22,7 @@
{
self,
nixpkgs,
rust-overlay,
fenix,
treefmt-nix,
}:
let
Expand Down Expand Up @@ -84,7 +87,7 @@

mkStatic = pkgs.callPackage ./nix/static.nix {
inherit (packages') refraction;
rust-overlay = rust-overlay.packages.${system};
fenix = fenix.packages.${system};
};

containerize =
Expand Down
14 changes: 8 additions & 6 deletions nix/static.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
lib,
refraction,
rust-overlay,
pkgsCross,
fenix,
refraction,
}:
let
crossPlatformFor = with pkgsCross; {
x86_64 = musl64.pkgsStatic;
aarch64 = aarch64-multiplatform.pkgsStatic;
};

toolchain = rust-overlay.rust.minimal.override {
extensions = [ "rust-std" ];
targets = lib.mapAttrsToList (_: pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget) crossPlatformFor;
};
toolchain = fenix.combine (
[ fenix.stable.minimalToolchain ]
++ lib.mapAttrsToList (
_: pkgs: fenix.targets.${pkgs.stdenv.hostPlatform.rust.rustcTarget}.stable.rust-std
) crossPlatformFor
);

rustPlatformFor = lib.mapAttrs (
_: pkgs:
Expand Down

0 comments on commit d34b7f7

Please sign in to comment.