forked from daily-co/synthetic-network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
45 lines (37 loc) · 1.28 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
# Run like this:
# nix-build /path/to/this/directory
# ... build products will be in ./result
# Cross-compile via
# https://github.com/mozilla/nixpkgs-mozilla/issues/91#issuecomment-464483970
{ pkgs ? <nixpkgs>, source ? ./., version ? "dev", crossSystem ? null }:
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import pkgs { overlays = [ moz_overlay ]; inherit crossSystem; };
targets = [ nixpkgs.stdenv.targetPlatform.config ];
in
with nixpkgs;
stdenv.mkDerivation {
name = "rush-${version}";
#src = lib.cleanSource (lib.sourceByRegex source ["target/*"]);
# build time dependencies targeting the build platform
depsBuildBuild = [ buildPackages.stdenv.cc ];
HOST_CC = "cc";
# build time dependencies targeting the host platform
nativeBuildInputs = [
# to use a specific nighly:
((buildPackages.buildPackages.rustChannelOf {date="2021-02-11"; channel="nightly";})
.rust)
# nodeJS 12.x
nodejs-12_x
# other test dependencies:
iperf
];
shellHook = ''
export RUSTFLAGS="-C linker=$CC"
'';
CARGO_BUILD_TARGET = targets;
inherit version;
# Set Environment Variables
RUST_TEST_THREADS = 1;
RUST_BACKTRACE = 1;
}