forked from fedimint/fedimint-clientd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
129 lines (116 loc) · 4.14 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
{
description =
"A fedimint client daemon for server side applications to hold, use, and manage Bitcoin and ecash";
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-23.11"; };
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flakebox = {
url = "github:dpc/flakebox?rev=226d584e9a288b9a0471af08c5712e7fac6f87dc";
inputs.nixpkgs.follows = "nixpkgs";
inputs.fenix.follows = "fenix";
};
flake-utils.url = "github:numtide/flake-utils";
fedimint = {
url =
"github:fedimint/fedimint?rev=dbabb5f44de5401d24ca9414534a36a22e89c6df";
};
};
outputs = { self, nixpkgs, flakebox, fenix, 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"
"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 ];
};
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# on Darwin newest stdenv doesn't seem to work
# linking rocksdb
stdenv = pkgs.clang11Stdenv;
clang = llvmPackages.clang;
libclang = llvmPackages.libclang.lib;
clang-unwrapped = llvmPackages.clang-unwrapped;
};
# 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";
};
});
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"
'';
};
});
}