-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
75 lines (64 loc) · 1.37 KB
/
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
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
{ makeRustPlatform
, pkg-config
, gcc
, nix
, boost
, libclang
, writeText
, writeShellScriptBin
, symlinkJoin
, rust-bin
}:
let
demo-url = "127.0.0.1:8080";
demo-config-server = writeText "config.toml" ''
version = "v1"
listen = "${demo-url}"
signing_key = "demo.nixcache-0:vjg4zb3o8U3SapIoeG5dWZ9+G4OyqA96J2+nxuoMPCT3a7/zXWgXpuKr+rJWChlyTGeCV2aARebK+ffmh+u2fw=="
[storage]
type = "local"
path = "/tmp/_demo_nixcache"
'';
demo-config-client = writeText "config.toml" ''
version = "v1"
[server]
endpoint = "http://${demo-url}"
'';
myRustPlatform = makeRustPlatform {
cargo = rust-bin.stable.latest.default;
rustc = rust-bin.stable.latest.default;
};
in rec {
nixcache = myRustPlatform.buildRustPackage {
name = "nixcache";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [
pkg-config
myRustPlatform.bindgenHook
gcc
];
buildInputs = [
nix
boost
libclang.lib
];
doCheck = false;
};
demo-nixcached = writeShellScriptBin "demo-nixcached" ''
exec ${nixcache}/bin/nixcached --config ${demo-config-server}
'';
demo-nixcache = writeShellScriptBin "demo-nixcache" ''
exec ${nixcache}/bin/nixcache --config ${demo-config-client}
'';
demo = symlinkJoin {
name = "demo-nixcache";
paths = [
demo-nixcached
demo-nixcache
];
};
default = nixcache;
}