-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
78 lines (66 loc) · 1.58 KB
/
flake.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
{
description = "WHS CRISiSLab Challenge 2024 project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
};
outputs = {
self,
nixpkgs,
flake-utils,
naersk,
nixpkgs-mozilla
}: flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import nixpkgs-mozilla) ];
};
toolchain = (pkgs.rustChannelOf {
channel = "nightly";
date = "2024-06-13";
sha256 = "sha256-s5nlYcYG9EuO2HK2BU3PkI928DZBKCTJ4U9bz3RX1t4=";
}).rust;
naersk' = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
relayNativeBuildInputs = with pkgs; [ pkg-config cmake makeWrapper ];
relayBuildInputs = [ pkgs.openssl ];
libsslPath = pkgs.lib.makeLibraryPath [ pkgs.openssl ];
in {
packages = {
relay = naersk'.buildPackage {
src = ./backend/relay;
nativeBuildInputs = relayNativeBuildInputs;
buildInputs = relayBuildInputs;
postInstall = ''
wrapProgram "$out/bin/relay" \
--suffix LD_LIBRARY_PATH : ${libsslPath}
'';
};
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
mosquitto
];
};
relay = pkgs.mkShell {
buildInputs =
relayNativeBuildInputs ++
relayBuildInputs ++
[
toolchain
pkgs.cargo-flamegraph
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
};
});
}