From 301f9236e5503f1d5bd39b2262041a8361f43545 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 3 Dec 2023 10:55:05 +0800 Subject: [PATCH] switch to nixpkgs cargo-xbuild (with workaround for rust nonsense) --- flake.nix | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/flake.nix b/flake.nix index 3534d01..7706710 100644 --- a/flake.nix +++ b/flake.nix @@ -139,26 +139,6 @@ }; }; - cargo-xbuild = rustPlatform.buildRustPackage rec { - pname = "cargo-xbuild"; - version = "0.6.5"; - - src = pkgs.fetchFromGitHub { - owner = "rust-osdev"; - repo = pname; - rev = "v${version}"; - sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf"; - }; - cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8"; - - meta = with pkgs.lib; { - description = "Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc"; - homepage = "https://github.com/rust-osdev/cargo-xbuild"; - license = with licenses; [ mit asl20 ]; - maintainers = with maintainers; [ johntitor xrelkd ]; - }; - }; - mkbootimage = pkgs.stdenv.mkDerivation { pname = "mkbootimage"; version = "2.3dev"; @@ -213,6 +193,10 @@ dontFixup = true; }; + cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: { + postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018"; + }); + build-crate = name: crate: features: rustPlatform.buildRustPackage rec { name = "${crate}"; @@ -269,16 +253,16 @@ devShell.x86_64-linux = pkgs.mkShell { name = "zynq-rs-dev-shell"; - buildInputs = with pkgs; [ + buildInputs = [ rust - cacert cargo-xbuild + mkbootimage - openocd gdb - openssh rsync - llvmPackages_14.clang-unwrapped - (python3.withPackages(ps: [ ps.pyftdi ])) - mkbootimage ]; - }; + pkgs.openocd pkgs.gdb + pkgs.openssh pkgs.rsync + pkgs.llvmPackages_14.clang-unwrapped + (pkgs.python3.withPackages(ps: [ ps.pyftdi ])) + ]; + }; }; }