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