You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
malachite/flake.nix

86 lines
2.2 KiB
Nix

2 years ago
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2 years ago
utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
2 years ago
};
2 years ago
outputs = {
self,
nixpkgs,
utils,
naersk,
fenix,
2 years ago
}:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
toolchain = with fenix.packages."${system}";
combine [
minimal.rustc
minimal.cargo
targets.x86_64-pc-windows-gnu.latest.rust-std
targets.x86_64-unknown-linux-gnu.latest.rust-std
];
naersk-lib = naersk.lib."${system}".override {
cargo = toolchain;
rustc = toolchain;
};
2 years ago
in rec
{
packages.malachite = naersk-lib.buildPackage {
pname = "Malachite";
root = ./.;
};
packages.malachite-win = naersk-lib.buildPackage {
pname = "Malachite";
2 years ago
root = ./.;
strictDeps = true;
depsBuildBuild = with pkgs; [
pkgsCross.mingwW64.stdenv.cc
pkgsCross.mingwW64.windows.pthreads
];
nativeBuildInputs = with pkgs; [
(
if system == "x86_64-linux"
then wineWowPackages.stable
else hello
)
];
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = pkgs.writeScript "wine-wrapper" ''
export WINEPREFIX="$(mktemp -d)"
exec wine64 $@
'';
doCheck = true;
2 years ago
};
2 years ago
2 years ago
packages.default = packages.malachite;
2 years ago
apps.apod = utils.lib.mkApp {
2 years ago
drv = packages.malachite;
};
2 years ago
apps.default = apps.malachite;
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
cargo-audit
rustfmt
2 years ago
clippy
];
};
formatter = pkgs.alejandra;
});
2 years ago
}