-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.nix
39 lines (32 loc) · 878 Bytes
/
package.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
{ lib
, stdenv
, craneLib
, pkg-config
, cmake
, apple-sdk
}:
let target = lib.strings.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] stdenv.targetPlatform.config);
in
craneLib.buildPackage {
src = lib.fileset.toSource rec {
root = ./.;
fileset = lib.fileset.unions [
(craneLib.fileset.commonCargoSources root)
(lib.fileset.fileFilter (file: file.hasExt "h") root)
];
};
strictDeps = true;
doCheck = false;
nativeBuildInputs = [
pkg-config
cmake
stdenv.cc
];
nativeInput = lib.optionals stdenv.isDarwin [ apple-sdk ];
CARGO_BUILD_TARGET = stdenv.targetPlatform.config;
"CARGO_TARGET_${target}_LINKER" = "${stdenv.cc.targetPrefix}cc";
RUSTFLAGS = "-C target-feature=-crt-static";
cargoExtraArgs = "--features encryption";
HOST_CC = "${stdenv.cc.nativePrefix}cc";
TARGET_CC = "${stdenv.cc.targetPrefix}cc";
}