69 lines
2.3 KiB
Nix
69 lines
2.3 KiB
Nix
{
|
|
description = "Finite Difference Time Domain simulation binaries";
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixos-22.05";
|
|
flake-utils.url = github:numtide/flake-utils;
|
|
rust-overlay.url = github:oxalica/rust-overlay;
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
with flake-utils.lib; eachSystem allSystems (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ rust-overlay.overlays.default ];
|
|
};
|
|
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
python-packages = pypkg: with pypkg; [
|
|
natsort
|
|
pandas
|
|
plotly
|
|
scipy
|
|
];
|
|
python3 = pkgs.python3.withPackages python-packages;
|
|
in
|
|
rec {
|
|
packages = {
|
|
# docs: <nixpkgs>/doc/languages-frameworks/rust.section.md
|
|
# docs: https://github.com/oxalica/rust-overlay
|
|
coremem = pkgs.rustPlatform.buildRustPackage {
|
|
name = "coremem";
|
|
buildInputs = [ pkgs.vulkan-loader ];
|
|
nativeBuildInputs = [ rust-toolchain ];
|
|
src = self;
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
# required for `nix build` to work... i guess
|
|
"rustc_codegen_spirv-0.4.0-alpha.15" = "sha256-waEOWZtj+Kr7pY0R54PQqJWA41TauPjUwI5KcY4GVow=";
|
|
};
|
|
};
|
|
# sim::spirv rgpu tests fail because we don't link vulkan-loader into the test runner.
|
|
doCheck = false;
|
|
|
|
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
preFixup = ''
|
|
# strictly speaking not *all* binaries need this, but this is easy.
|
|
patchelf --add-needed ${pkgs.vulkan-loader}/lib/libvulkan.so.1 $out/bin/*
|
|
'';
|
|
};
|
|
};
|
|
defaultPackage = packages.coremem;
|
|
|
|
devShells.default = with pkgs; mkShell {
|
|
# enables debug builds, if we want: https://github.com/NixOS/nixpkgs/issues/60919.
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
# Allow cargo to download crates.
|
|
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
|
|
buildInputs = [ rust-toolchain python3 ];
|
|
|
|
# Runtime dependencies.
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.vulkan-loader ];
|
|
};
|
|
});
|
|
}
|