-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
103 lines (100 loc) · 2.82 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
description = "LoFiRe";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
inputs.utils.url = "github:numtide/flake-utils";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = {
self,
nixpkgs,
utils,
rust-overlay,
}:
utils.lib.eachDefaultSystem (system: let
overlays = [
(import rust-overlay)
];
pkgs = import nixpkgs rec {
inherit system overlays;
};
rust = pkgs.rust-bin.stable."1.62.0".default.override {
extensions = ["rust-src"];
};
buildRustPackage =
(pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
})
.buildRustPackage;
myNativeBuildInputs = with pkgs;
[
pkgconfig
]
++ lib.optionals stdenv.isLinux
(with pkgs; [
cargo-kcov
]);
myBuildInputs = with pkgs;
[
openssl
]
++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [
Security
]);
myBuildRustPackage = attrs:
buildRustPackage ({
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"lmdb-crypto-rs-0.14.0" = "sha256-cCTQuYxhiFHQZb+OW997sis50z5XrQk+KiTeaa2mlhk=";
"rkv-0.18.0" = "sha256-G0E2qC4Uie4es91aNiVZeI50SLBUc0KQQq+t08kpRIc=";
};
};
nativeBuildInputs = myNativeBuildInputs;
buildInputs = myBuildInputs;
RUST_BACKTRACE = 1;
}
// attrs);
in rec {
packages = rec {
lofire = myBuildRustPackage rec {
pname = "lofire";
buildAndTestSubdir = "./lofire";
};
lofire-broker = myBuildRustPackage rec {
pname = "lofire-broker";
buildAndTestSubdir = "./lofire-broker";
};
lofire-p2p = myBuildRustPackage rec {
pname = "lofire-p2p";
buildAndTestSubdir = "./lofire-p2p";
};
lofire-store-lmdb = myBuildRustPackage rec {
pname = "lofire-store-lmdb";
buildAndTestSubdir = "./lofire-store-lmdb";
};
lofire-node = myBuildRustPackage rec {
pname = "lofire-node";
buildAndTestSubdir = "./lofire-node";
};
lofire-demo = myBuildRustPackage rec {
pname = "lofire-demo";
buildAndTestSubdir = "./lofire-demo";
};
default = lofire-node;
};
apps = rec {
lofire-node = utils.lib.mkApp {
drv = packages.lofire-node;
exePath = "/bin/lofire-node";
};
lofire-demo = utils.lib.mkApp {
drv = packages.lofire-demo;
exePath = "/bin/lofire-demo";
};
default = lofire-node;
};
});
}