-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
65 lines (59 loc) · 1.95 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
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
utils,
naersk,
...
}: utils.lib.eachDefaultSystem (system:
let
cln-overlay = final: prev: {
clightning = prev.clightning.overrideAttrs {
version = "23.11";
src = prev.fetchFromGitHub {
owner = "niftynei";
repo = "lightning";
#rev = "44c5b523683160e8c20bda200c6a5a59ea40bc5e";
rev = "37ad798a02336a82460b865fd4e6a29d8880856c";
sha256 = "sha256-pkXU4JB5Y2oN/2DfYNRgGJdH36Nz3gmVfC/Exv2E2Zk=";
fetchSubmodules = true;
};
};
};
pkgs = import nixpkgs {
inherit system;
overlays = [ cln-overlay ];
};
naersk-lib = pkgs.callPackage naersk {};
in rec {
defaultPackage = naersk-lib.buildPackage {
src = ./.;
buildInputs = with pkgs; [ pkg-config openssl clightning ];
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ bash cargo rustc rustfmt pre-commit rustPackages.clippy pkg-config openssl bitcoin clightning poetry ];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
shellHook = ''
echo "Entering devshell..."
echo "Run \`cargo build\` to build \`smaug\`."
echo ""
echo "If this is your first time setting up smaug, run:"
echo "mkdir -p ~/.bitcoin"
echo ""
echo "Then to set up two lightning nodes and a bitcoin node in regtest mode,"
echo "run the following two commands:"
echo "source ${pkgs.clightning.src}/contrib/startup_regtest.sh"
echo "start_ln"
echo ""
echo "Finally, to start smaug on Lightning Node 1, run"
echo "l1-cli plugin start $(pwd)/target/debug/smaug"
'';
};
}
);
}