-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
119 lines (112 loc) · 3.08 KB
/
flake.nix
File metadata and controls
119 lines (112 loc) · 3.08 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
description = "Bitcoin Core IPC metrics exporter (Rust, Cap'n Proto)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
bitcoin-node-src = {
url = "github:willcl-ark/bitcoin/pr/trace";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
crane,
bitcoin-node-src,
...
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
mkPkgs =
system:
import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
mkCraneLib =
system:
let
pkgs = mkPkgs system;
rust = pkgs.rust-bin.stable.latest.default;
in
(crane.mkLib pkgs).overrideToolchain rust;
in
{
nixosModules.default = import ./module.nix;
overlays.default = final: prev: {
bitcoin-node = self.packages.${final.system}.bitcoin-node;
bitcoind = self.packages.${final.system}.bitcoin-node;
bitcoin-cli = self.packages.${final.system}.bitcoin-node;
};
packages = forAllSystems (
system:
let
pkgs = mkPkgs system;
craneLib = mkCraneLib system;
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter =
path: type: (builtins.match ".*\\.capnp$" path != null) || (craneLib.filterCargoSources path type);
};
commonArgs = {
inherit src;
pname = "ipc-exporter-rust";
version = "0.1.0";
nativeBuildInputs = [ pkgs.capnproto ];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
{
default = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
bitcoin-node = pkgs.bitcoind.overrideAttrs (old: {
pname = "bitcoin-node";
version = "30.99-tracing";
src = bitcoin-node-src;
buildInputs = old.buildInputs ++ [ pkgs.libsodium ];
cmakeFlags = old.cmakeFlags ++ [
(pkgs.lib.cmakeBool "WITH_MULTIPROCESS" true)
];
preUnpack = "";
doCheck = false;
doInstallCheck = false;
postInstall =
(old.postInstall or "")
+ ''
ln -sf $out/libexec/bitcoin-node $out/bin/bitcoind
'';
});
}
);
devShells = forAllSystems (
system:
let
pkgs = mkPkgs system;
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
};
in
{
default = pkgs.mkShell {
buildInputs = [
rust
pkgs.capnproto
pkgs.just
];
};
}
);
};
}