nix-build works

This commit is contained in:
Anton-4 2022-07-27 14:35:39 +02:00
parent b791729046
commit 11fd062a86
No known key found for this signature in database
GPG Key ID: A13F4A6E21141925
3 changed files with 14 additions and 2 deletions

View File

@ -351,6 +351,11 @@ pub fn root_dir() -> PathBuf {
path.pop(); path.pop();
path.pop(); path.pop();
// running cargo with --target will put us in the target dir
if path.ends_with("target") {
path.pop();
}
path path
} }

View File

@ -16,7 +16,7 @@ rustPlatform.buildRustPackage {
src = pkgs.nix-gitignore.gitignoreSource [] ./.; src = pkgs.nix-gitignore.gitignoreSource [] ./.;
cargoSha256 = "sha256-oSi9UIom3YowgfR1U4c6her3SsfeV//t6Dy3eOQaW9o="; cargoSha256 = "sha256-ey1zHqiFhGNgjQLC6ATEH6i7RcuXJGcijGMcv9amn0w=";
LLVM_SYS_130_PREFIX = "${llvmPkgs.llvm.dev}"; LLVM_SYS_130_PREFIX = "${llvmPkgs.llvm.dev}";
@ -37,12 +37,18 @@ rustPlatform.buildRustPackage {
''; '';
# required for zig # required for zig
XDG_CACHE_HOME = "/build/xdgcache"; XDG_CACHE_HOME = "xdg_cache"; # prevents zig AccessDenied error github.com/ziglang/zig/issues/6810
# nix does not store libs in /usr/lib or /lib # nix does not store libs in /usr/lib or /lib
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else ""; NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
# want to see backtrace in case of failure # want to see backtrace in case of failure
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
# skip running rust tests, problems:
# building of example platforms requires network: Could not resolve host
# zig AccessDenied error github.com/ziglang/zig/issues/6810
# Once instance has previously been poisoned ??
doCheck = false;
nativeBuildInputs = (with pkgs; [ nativeBuildInputs = (with pkgs; [
cmake cmake
git git

View File

@ -5,3 +5,4 @@ components = [
# for usages of rust-analyzer or similar tools inside `nix develop` # for usages of rust-analyzer or similar tools inside `nix develop`
"rust-src" "rust-src"
] ]
targets = [ "x86_64-unknown-linux-gnu" ]