-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathflake.nix
151 lines (138 loc) · 4.2 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
description = "A fedimint client daemon for server side applications to hold, use, and manage Bitcoin and ecash";
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-24.05";
};
flakebox = {
url = "github:rustshop/flakebox?rev=ee39d59b2c3779e5827f8fa2d269610c556c04c8";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
fedimint = {
url = "github:fedimint/fedimint?ref=v0.4.2";
};
};
outputs =
{
self,
nixpkgs,
flakebox,
flake-utils,
fedimint,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = fedimint.overlays.fedimint;
};
lib = pkgs.lib;
flakeboxLib = flakebox.lib.${system} { };
rustSrc = flakeboxLib.filterSubPaths {
root = builtins.path {
name = "fedimint-clientd";
path = ./.;
};
paths = [
"Cargo.toml"
"Cargo.lock"
".cargo"
"src"
"multimint"
"fedimint-clientd"
"fedimint-nwc"
"clientd-stateless"
];
};
toolchainArgs =
let
llvmPackages = pkgs.llvmPackages_11;
in
{
extraRustFlags = "--cfg tokio_unstable";
components = [
"rustc"
"cargo"
"clippy"
"rust-analyzer"
"rust-src"
];
args = {
nativeBuildInputs = [
pkgs.wasm-bindgen-cli
pkgs.geckodriver
pkgs.wasm-pack
] ++ lib.optionals (!pkgs.stdenv.isDarwin) [ pkgs.firefox ];
};
};
# all standard toolchains provided by flakebox
toolchainsStd = flakeboxLib.mkStdFenixToolchains toolchainArgs;
toolchainsNative = (pkgs.lib.getAttrs [ "default" ] toolchainsStd);
toolchainNative = flakeboxLib.mkFenixMultiToolchain { toolchains = toolchainsNative; };
commonArgs = {
buildInputs =
[ ]
++ lib.optionals pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.SystemConfiguration ];
nativeBuildInputs = [ pkgs.pkg-config ];
};
outputs = (flakeboxLib.craneMultiBuild { toolchains = toolchainsStd; }) (
craneLib':
let
craneLib =
(craneLib'.overrideArgs {
pname = "flexbox-multibuild";
src = rustSrc;
}).overrideArgs
commonArgs;
in
rec {
workspaceDeps = craneLib.buildWorkspaceDepsOnly { };
workspaceBuild = craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; };
fedimint-clientd = craneLib.buildPackageGroup {
pname = "fedimint-clientd";
packages = [ "fedimint-clientd" ];
mainProgram = "fedimint-clientd";
};
fedimint-clientd-oci = pkgs.dockerTools.buildLayeredImage {
name = "fedimint-clientd";
contents = [ fedimint-clientd ];
config = {
Cmd = [ "${fedimint-clientd}/bin/fedimint-clientd" ];
};
};
}
);
in
{
legacyPackages = outputs;
packages = {
default = outputs.fedimint-clientd;
};
devShells = flakeboxLib.mkShells {
packages = [ ];
buildInputs = commonArgs.buildInputs;
nativeBuildInputs = [
pkgs.mprocs
pkgs.go
pkgs.bun
pkgs.bitcoind
pkgs.clightning
pkgs.lnd
pkgs.esplora-electrs
pkgs.electrs
commonArgs.nativeBuildInputs
fedimint.packages.${system}.devimint
fedimint.packages.${system}.gateway-pkgs
fedimint.packages.${system}.fedimint-pkgs
];
shellHook = ''
export RUSTFLAGS="--cfg tokio_unstable"
export RUSTDOCFLAGS="--cfg tokio_unstable"
export RUST_LOG="info"
'';
};
}
);
}