-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
54 lines (48 loc) · 1.6 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
{
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
pkgs = import nixpkgs {
inherit system;
};
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 bitcoin clightning cargo gawk libeatmydata openssl pkg-config poetry pre-commit rustc rustfmt rustPackages.clippy ];
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 ""
# Extract CLN zip file to a temporary directory
TMP_DIR=$(mktemp -d)
unzip -q ${pkgs.clightning.src} -d "$TMP_DIR"
echo "Then to set up two lightning nodes and a bitcoin node in regtest mode,"
echo "run the following two commands:"
echo "source $TMP_DIR/clightning-v24.08.1/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"
'';
};
}
);
}