forked from M-Labs/zynq-rs
altering flake.nix WIP
This commit is contained in:
parent
b2b3e5c933
commit
91607ea8e8
46
flake.lock
46
flake.lock
|
@ -1,28 +1,12 @@
|
|||
{
|
||||
"nodes": {
|
||||
"mozilla-overlay": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1704373101,
|
||||
"narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=",
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1720386169,
|
||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||
"lastModified": 1721548954,
|
||||
"narHash": "sha256-7cCC8+Tdq1+3OPyc3+gVo9dzUNkNIQfwSDJ2HSi2u3o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||
"rev": "63d37ccd2d178d54e7fb691d7ec76000740ea24a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -34,8 +18,28 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"mozilla-overlay": "mozilla-overlay",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721701191,
|
||||
"narHash": "sha256-nM4szL90VeZHZEC5rFfaiiPNTVOmsihdtk2QSP1l37I=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "4674ff2c2e5423a0cebe16e61aa874c359306af4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
72
flake.nix
72
flake.nix
|
@ -2,37 +2,47 @@
|
|||
description = "Bare-metal Rust on Zynq-7000";
|
||||
|
||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05;
|
||||
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
||||
|
||||
outputs = { self, nixpkgs, mozilla-overlay }:
|
||||
let
|
||||
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=";
|
||||
#inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
||||
inputs.rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
rustTargets = [];
|
||||
rustChannelOfTargets = _channel: _date: targets:
|
||||
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit (pkgs) stdenv lib fetchurl patchelf;
|
||||
}).rust.override {
|
||||
inherit targets;
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay }:
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-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:
|
||||
# (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."2023-04-20".default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
};
|
||||
rust = rustChannelOfTargets "nightly" null rustTargets;
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
});
|
||||
|
||||
# https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility
|
||||
llvmPackages_11 = pkgs.recurseIntoAttrs (pkgs.callPackage (import ./llvm/11) ({
|
||||
inherit (pkgs.stdenvAdapters) overrideCC;
|
||||
buildLlvmTools = null;
|
||||
targetLlvmLibraries = null;
|
||||
targetLlvm = null;
|
||||
}));
|
||||
## https://doc.rust-lang.org/rustc/linker-plugin-lto.html#toolchain-compatibility
|
||||
#llvmPackages_11 = pkgs.recurseIntoAttrs (pkgs.callPackage (import ./llvm/11) ({
|
||||
# inherit (pkgs.stdenvAdapters) overrideCC;
|
||||
# buildLlvmTools = null;
|
||||
# targetLlvmLibraries = null;
|
||||
# targetLlvm = null;
|
||||
#}));
|
||||
|
||||
crosspkgs-overlay = (self: super: {
|
||||
pkgsCross = super.pkgsCross // {
|
||||
|
@ -104,9 +114,13 @@
|
|||
dontFixup = true;
|
||||
};
|
||||
|
||||
cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
|
||||
postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018";
|
||||
});
|
||||
cargo-xbuild = pkgs.cargo-xbuild;
|
||||
#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 {
|
||||
name = "${crate}";
|
||||
|
@ -116,7 +130,7 @@
|
|||
) ./.;
|
||||
cargoLock = { lockFile = ./Cargo.lock; };
|
||||
|
||||
nativeBuildInputs = [ cargo-xbuild llvmPackages_11.clang-unwrapped ];
|
||||
nativeBuildInputs = [ cargo-xbuild pkgs.llvmPackages_16.clang-unwrapped ];
|
||||
buildPhase = ''
|
||||
export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library"
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
|
@ -161,7 +175,7 @@
|
|||
|
||||
hydraJobs = packages.x86_64-linux;
|
||||
|
||||
inherit rust rustPlatform llvmPackages_11;
|
||||
inherit rust rustPlatform;
|
||||
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
name = "zynq-rs-dev-shell";
|
||||
|
@ -172,7 +186,7 @@
|
|||
|
||||
pkgs.openocd pkgs.gdb
|
||||
pkgs.openssh pkgs.rsync
|
||||
llvmPackages_11.clang-unwrapped
|
||||
pkgs.llvmPackages_16.clang-unwrapped
|
||||
(pkgs.python3.withPackages(ps: [ ps.pyftdi ]))
|
||||
];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue