forked from M-Labs/nac3
42 lines
1.0 KiB
Nix
42 lines
1.0 KiB
Nix
|
|
{ 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)}
|
|
'';
|
|
} |