-
Notifications
You must be signed in to change notification settings - Fork 19
/
flake.nix
122 lines (108 loc) · 4.02 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
{
description = "A custom fedimint module";
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=a41e3a7e31ce0f26058206a04f1cd49ef2b12fe3";
};
};
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-roastr";
path = ./.;
};
paths = [ "Cargo.toml" "Cargo.lock" ".cargo" "src" ];
};
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; };
fedimintd-custom = craneLib.buildPackageGroup {
pname = "fedimint-custom";
packages = [ "fedimint-custom" ];
mainProgram = "fedimint-custom";
};
});
in {
legacyPackages = outputs;
packages = { default = outputs.fedimintd-custom; };
devShells = flakeboxLib.mkShells {
packages = [ ];
buildInputs = commonArgs.buildInputs;
nativeBuildInputs = [
pkgs.mprocs
pkgs.bitcoind
pkgs.clightning
pkgs.lnd
pkgs.esplora-electrs
pkgs.electrs
pkgs.protobuf
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"
export PROTOC="${pkgs.protobuf}/bin/protoc"
export PROTOC_INCLUDE="${pkgs.protobuf}/include"
'';
};
});
}