update flake
This commit is contained in:
parent
b2b3e5c933
commit
1307297583
80
flake.nix
80
flake.nix
|
@ -2,37 +2,47 @@
|
||||||
description = "Bare-metal Rust on Zynq-7000";
|
description = "Bare-metal Rust on Zynq-7000";
|
||||||
|
|
||||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05;
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05;
|
||||||
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
#inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
||||||
|
inputs.rust-overlay = {
|
||||||
outputs = { self, nixpkgs, mozilla-overlay }:
|
url = "github:oxalica/rust-overlay?ref=snapshot/2024-08-01";
|
||||||
let
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) crosspkgs-overlay ]; };
|
|
||||||
|
|
||||||
rustManifest = pkgs.fetchurl {
|
|
||||||
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
|
||||||
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
|
|
||||||
};
|
};
|
||||||
rustTargets = [];
|
|
||||||
rustChannelOfTargets = _channel: _date: targets:
|
outputs = { self, nixpkgs, rust-overlay }:
|
||||||
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
let
|
||||||
inherit (pkgs) stdenv lib fetchurl patchelf;
|
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) crosspkgs-overlay ]; };
|
||||||
}).rust.override {
|
|
||||||
inherit targets;
|
# rustManifest = pkgs.fetchurl {
|
||||||
|
# url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
||||||
|
# sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
|
||||||
|
# };
|
||||||
|
# rustTargets = [];
|
||||||
|
# rustChannelOfTargets = _channel: _date: targets:
|
||||||
|
# (pkgs.lib.rustLib.fromManifestFile rustManifest {
|
||||||
|
# inherit (pkgs) stdenv lib fetchurl patchelf;
|
||||||
|
# }).rust.override {
|
||||||
|
# inherit targets;
|
||||||
|
# extensions = ["rust-src"];
|
||||||
|
# };
|
||||||
|
# rust = rustChannelOfTargets "nightly" null rustTargets;
|
||||||
|
|
||||||
|
# rustc version needs to match LLVM version, else ABI bugs
|
||||||
|
# https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility
|
||||||
|
rust = pkgs.rust-bin.nightly."2021-09-20".default.override {
|
||||||
extensions = [ "rust-src" ];
|
extensions = [ "rust-src" ];
|
||||||
};
|
};
|
||||||
rust = rustChannelOfTargets "nightly" null rustTargets;
|
|
||||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||||
rustc = rust;
|
rustc = rust;
|
||||||
cargo = rust;
|
cargo = rust;
|
||||||
});
|
});
|
||||||
|
|
||||||
# https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility
|
## https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility
|
||||||
llvmPackages_11 = pkgs.recurseIntoAttrs (pkgs.callPackage (import ./llvm/11) ({
|
#llvmPackages_11 = pkgs.recurseIntoAttrs (pkgs.callPackage (import ./llvm/11) ({
|
||||||
inherit (pkgs.stdenvAdapters) overrideCC;
|
# inherit (pkgs.stdenvAdapters) overrideCC;
|
||||||
buildLlvmTools = null;
|
# buildLlvmTools = null;
|
||||||
targetLlvmLibraries = null;
|
# targetLlvmLibraries = null;
|
||||||
targetLlvm = null;
|
# targetLlvm = null;
|
||||||
}));
|
#}));
|
||||||
|
|
||||||
crosspkgs-overlay = (self: super: {
|
crosspkgs-overlay = (self: super: {
|
||||||
pkgsCross = super.pkgsCross // {
|
pkgsCross = super.pkgsCross // {
|
||||||
|
@ -104,9 +114,13 @@
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
|
cargo-xbuild = pkgs.cargo-xbuild;
|
||||||
postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018";
|
#cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
|
||||||
});
|
# postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018";
|
||||||
|
#});
|
||||||
|
#cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
|
||||||
|
# postPatch = "substituteInPlace src/sysroot.rs --replace 2023 2018";
|
||||||
|
#});
|
||||||
|
|
||||||
build-crate = name: crate: features: rustPlatform.buildRustPackage rec {
|
build-crate = name: crate: features: rustPlatform.buildRustPackage rec {
|
||||||
name = "${crate}";
|
name = "${crate}";
|
||||||
|
@ -114,9 +128,15 @@
|
||||||
src = builtins.filterSource (path: type:
|
src = builtins.filterSource (path: type:
|
||||||
baseNameOf path != "target"
|
baseNameOf path != "target"
|
||||||
) ./.;
|
) ./.;
|
||||||
cargoLock = { lockFile = ./Cargo.lock; };
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cargo-xbuild llvmPackages_11.clang-unwrapped ];
|
cargoLock = {
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
outputHashes = {
|
||||||
|
"fatfs-0.3.6" = "sha256-guMlE0AjG9W9Fm4gUGghE5F1JA7IkV35fZAbYn+nb98=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cargo-xbuild pkgs.llvmPackages_13.clang-unwrapped ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library"
|
export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library"
|
||||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||||
|
@ -161,7 +181,7 @@
|
||||||
|
|
||||||
hydraJobs = packages.x86_64-linux;
|
hydraJobs = packages.x86_64-linux;
|
||||||
|
|
||||||
inherit rust rustPlatform llvmPackages_11;
|
inherit rust rustPlatform;
|
||||||
|
|
||||||
devShell.x86_64-linux = pkgs.mkShell {
|
devShell.x86_64-linux = pkgs.mkShell {
|
||||||
name = "zynq-rs-dev-shell";
|
name = "zynq-rs-dev-shell";
|
||||||
|
@ -172,7 +192,7 @@
|
||||||
|
|
||||||
pkgs.openocd pkgs.gdb
|
pkgs.openocd pkgs.gdb
|
||||||
pkgs.openssh pkgs.rsync
|
pkgs.openssh pkgs.rsync
|
||||||
llvmPackages_11.clang-unwrapped
|
pkgs.llvmPackages_13.clang-unwrapped
|
||||||
(pkgs.python3.withPackages(ps: [ ps.pyftdi ]))
|
(pkgs.python3.withPackages(ps: [ ps.pyftdi ]))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue