-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
87 lines (77 loc) · 2.12 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
pkgs ? import <nixpkgs> {},
fenix ? import <fenix> {},
}: let
lib = pkgs.lib;
getLibFolder = pkg: "${pkg}/lib";
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
# Rust Toolchain
target = "aarch64-unknown-none-softfloat";
toolchain = fenix.packages.${pkgs.system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-0Hcko7V5MUtH1RqrOyKQLg0ITjJjtyRPl2P+cJ1p1cY=";
};
in
pkgs.rustPlatform.buildRustPackage {
pname = "sark";
version = manifest.package.version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = with pkgs; [
# LLVM & GCC
gcc
cmake
gnumake
pkg-config
gcc-arm-embedded
llvmPackages.llvm
llvmPackages.clang
# Rust
toolchain
# Testing & Deployment
ruby
bundler
# Embedded
qemu
rustfilt
cargo-binutils
];
buildInputs = with pkgs; [
qemu
openssl
libressl
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.gcc
pkgs.libiconv
pkgs.gcc-arm-embedded
pkgs.llvmPackages.llvm
];
RUST_BACKTRACE = 1;
RUSTFLAGS = "-C target-cpu=cortex-a53 -C link-arg=--library-path=./src/bsp/raspberrypi -C link-arg=--script=kernel.ld -D warnings -D missing_docs";
CARGO_BUILD_TARGET = target;
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = let
inherit (pkgs.pkgsCross.aarch64-multiplatform.stdenv) cc;
in "${cc}/bin/${cc.targetPrefix}cc";
NIX_LDFLAGS = "-L${(getLibFolder pkgs.libiconv)}";
meta = with lib; {
homepage = manifest.package.homepage;
description = manifest.package.description;
license = with lib.licenses; [asl20 mit];
platforms = with platforms; linux ++ darwin;
maintainers = [
{
name = "Sokhibjon Orzikulov";
email = "[email protected]";
handle = "orzklv";
github = "orzklv";
githubId = 54666588;
keys = [
{
fingerprint = "00D2 7BC6 8707 0683 FBB9 137C 3C35 D3AF 0DA1 D6A8";
}
];
}
];
};
}