flake: simplify fsbl
This commit is contained in:
parent
a7db47276b
commit
8497f9746b
92
flake.nix
92
flake.nix
@ -214,60 +214,58 @@
|
||||
dontFixup = true;
|
||||
};
|
||||
# ==== fsbl/default
|
||||
cargoSha256Experiments = "1bvffgr4588bbkjwnhim8rvkjvbnajaiv7hc98b19sr8kb7rcj63";
|
||||
cargoSha256SZL = "13022ssk6s2fgxmmh5msbx01fzcmk2cj95fjpxcsmfy14k9wd77l";
|
||||
cargoSha256Experiments = "1bvffgr4588bbkjwnhim8rvkjvbnajaiv7hc98b19sr8kb7rcj63";
|
||||
cargoSha256SZL = "13022ssk6s2fgxmmh5msbx01fzcmk2cj95fjpxcsmfy14k9wd77l";
|
||||
|
||||
build-crate = name: crate: features: cargoSha256: rustPlatform.buildRustPackage rec {
|
||||
name = "${crate}";
|
||||
build-crate = name: crate: features: cargoSha256: rustPlatform.buildRustPackage rec {
|
||||
name = "${crate}";
|
||||
|
||||
src = builtins.filterSource (path: type:
|
||||
baseNameOf path != "target"
|
||||
) ./.;
|
||||
inherit cargoSha256;
|
||||
src = builtins.filterSource (path: type:
|
||||
baseNameOf path != "target"
|
||||
) ./.;
|
||||
inherit cargoSha256;
|
||||
|
||||
nativeBuildInputs = [ cargo-xbuild pkgs.llvmPackages_9.clang-unwrapped ];
|
||||
buildPhase = ''
|
||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library"
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
pushd ${crate}
|
||||
cargo xbuild --release --frozen \
|
||||
--no-default-features \
|
||||
--features=${features}
|
||||
popd
|
||||
'';
|
||||
nativeBuildInputs = [ cargo-xbuild pkgs.llvmPackages_9.clang-unwrapped ];
|
||||
buildPhase = ''
|
||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library"
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
pushd ${crate}
|
||||
cargo xbuild --release --frozen \
|
||||
--no-default-features \
|
||||
--features=${features}
|
||||
popd
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp target/armv7-none-eabihf/release/${name} $out/${name}.elf
|
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp target/armv7-none-eabihf/release/${name} $out/${name}.elf
|
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
dontFixup = true;
|
||||
};
|
||||
doCheck = false;
|
||||
dontFixup = true;
|
||||
};
|
||||
|
||||
fsblCrates = {
|
||||
zc706-fsbl = fsbl { board = "zc706"; };
|
||||
# any others?
|
||||
};
|
||||
|
||||
targetCrates = target: {
|
||||
"${target}-experiments" = build-crate "${target}-experiments" "experiments" "target_${target}" cargoSha256Experiments;
|
||||
"${target}-szl" = build-crate "${target}-szl" "szl" "target_${target}" cargoSha256SZL;
|
||||
};
|
||||
targets = ["zc706" "coraz7" "redpitaya" "kasli_soc"];
|
||||
allTargetCrates = (builtins.foldl' (results: target:
|
||||
results // targetCrates target
|
||||
) {} targets);
|
||||
szl = pkgs.runCommand "szl" {} (builtins.foldl' (commands: target:
|
||||
let
|
||||
szlResult = builtins.getAttr "${target}-szl" allTargetCrates;
|
||||
in
|
||||
commands + "ln -s ${szlResult}/szl.elf $out/szl-${target}.elf\n"
|
||||
) "mkdir $out\n" targets);
|
||||
|
||||
allOutputs = allTargetCrates // fsblCrates // { inherit cargo-xbuild szl; };
|
||||
targetCrates = target: {
|
||||
"${target}-experiments" = build-crate "${target}-experiments" "experiments" "target_${target}" cargoSha256Experiments;
|
||||
"${target}-szl" = build-crate "${target}-szl" "szl" "target_${target}" cargoSha256SZL;
|
||||
};
|
||||
targets = ["zc706" "coraz7" "redpitaya" "kasli_soc"];
|
||||
allTargetCrates = (builtins.foldl' (results: target:
|
||||
results // targetCrates target
|
||||
) {} targets);
|
||||
|
||||
szl = pkgs.runCommand "szl" {} (builtins.foldl' (commands: target:
|
||||
let
|
||||
szlResult = builtins.getAttr "${target}-szl" allTargetCrates;
|
||||
in
|
||||
commands + "ln -s ${szlResult}/szl.elf $out/szl-${target}.elf\n"
|
||||
) "mkdir $out\n" targets);
|
||||
|
||||
allOutputs = {
|
||||
inherit cargo-xbuild szl;
|
||||
zc706-fsbl = fsbl { board = "zc706"; };
|
||||
} // allTargetCrates ;
|
||||
in {
|
||||
packages.x86_64-linux = allOutputs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user