forked from M-Labs/nac3
1
0
Fork 0
nac3/nac3standalone/demo/linalg/default.nix

42 lines
1.0 KiB
Nix
Raw Normal View History

2024-08-05 11:37:52 +08:00
{ pkgsPath ? <nixpkgs>, crossSystem ? null }:
let
mozOverlay = import (
builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz
);
pkgs = import pkgsPath {
overlays = [ mozOverlay ];
inherit crossSystem;
};
targets = ["i686-unknown-linux-gnu" "x86_64-unknown-linux-gnu"];
in
with pkgs;
pkgs.rustPlatform.buildRustPackage {
name = "linalg";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [
(buildPackages.buildPackages.latest.rustChannels.stable.rust.override { inherit targets; })
];
buildPhase = ''
${builtins.concatStringsSep "\n" (map (target:
''
cargo build --release --target ${target}
''
) targets)}
'';
installPhase = ''
mkdir -p $out/lib
${builtins.concatStringsSep "\n" (map (target:
''
cp target/${target}/release/liblinalg.a $out/lib/liblinalg-${target}.a
''
) targets)}
'';
}