Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 30
if: |
github.event.action != 'edited' ||
github.event.action != 'edited' ||
contains(github.event.pull_request.body, 'Changelog')
env:
BOLTDIR: bolts
Expand Down Expand Up @@ -596,6 +596,25 @@ jobs:
cat config.vars
VALGRIND=0 uv run eatmydata pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}

check-flake:
name: Check Nix Flake
runs-on: ubuntu-22.04
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v8
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Check flake
run: nix flake check

gather:
# A dummy task that depends on the full matrix of tests, and
# signals successful completion. Used for the PR status to pass
Expand Down
6 changes: 3 additions & 3 deletions doc/developers-guide/developers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ The entry point is `flake.nix` in the root of the project, where the inputs and

`nix develop .#rust` will create a shell env for developing rust.

`nix build .?submodules=1` will build the default package (cln).
`nix build` will build the default package (cln).

`nix flake check .?submodules=1` will build the cln and rust packages. Rust tests are run during the build. There are also checks to run cargo audit and nixfmt.
`nix flake check` will build the cln and rust packages. Rust tests are run during the build. There are also checks to run cargo audit and nixfmt.

If you have nix installed you can use `nix run "git+https://github.com/hashrelay/lightning?ref=flake&submodules=1#lightningd"` to run lightningd without having to manually clone the repo. This make use of the flake output apps.
If you have nix installed you can use `nix run "git+https://github.com/hashrelay/lightning?ref=flake#lightningd"` to run lightningd without having to manually clone the repo. This makes use of the flake output `apps`.
63 changes: 26 additions & 37 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 8 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
description = "Core Lightning (CLN): A specification compliant Lightning Network implementation in C";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

flake-parts.url = "github:hercules-ci/flake-parts";

crane.url = "github:ipetkov/crane";

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};

advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};

self.submodules = true;
};

outputs =
Expand All @@ -29,6 +34,7 @@
inputs.treefmt-nix.flakeModule
./nix/pkgs/flake-module.nix
./nix/checks/flake-module.nix
./nix/apps.nix
./nix/shells.nix
./nix/treefmt.nix
];
Expand All @@ -45,20 +51,6 @@
inherit system;
overlays = [ (final: prev: { craneLib = (inputs.crane.mkLib pkgs); }) ];
};
apps = {
lightningd = {
program = "${self'.packages.cln}/bin/lightningd";
};
lightning-cli = {
program = "${self'.packages.cln}/bin/lightning-cli";
};
lightning-hsmtool = {
program = "${self'.packages.cln}/bin/lightning-hsmtool";
};
reckless = {
program = "${self'.packages.cln}/bin/reckless";
};
};
};
};
}
31 changes: 31 additions & 0 deletions nix/apps.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ ... }:
{
perSystem =
{
config,
pkgs,
system,
self',
...
}:
{
apps = {
lightningd = {
program = "${self'.packages.cln}/bin/lightningd";
meta.description = "Core Lightning daemon";
};
lightning-cli = {
program = "${self'.packages.cln}/bin/lightning-cli";
meta.description = "Core Lightning command line interface";
};
lightning-hsmtool = {
program = "${self'.packages.cln}/bin/lightning-hsmtool";
meta.description = "Core Lightning HSM tool";
};
reckless = {
program = "${self'.packages.cln}/bin/reckless";
meta.description = "Core Lightning reckless tool";
};
};
};
}
41 changes: 21 additions & 20 deletions nix/pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,27 @@ stdenv.mkDerivation {
# when building on darwin we need cctools to provide the correct libtool
# as libwally-core detects the host as darwin and tries to add the -static
# option to libtool, also we have to add the modified gsed package.
nativeBuildInputs =
[
autoconf
autogen
automake
gettext
gitMinimal
postgresql
libtool
lowdown
pkgconf
py3
unzip
which
]
++ lib.optionals postgresSupport [ postgresql ]
++ lib.optionals stdenv.isDarwin [
cctools
darwin.autoSignDarwinBinariesHook
];
nativeBuildInputs = [
autoconf
autogen
automake
gettext
gitMinimal
libtool
lowdown
pkgconf
py3
unzip
which
]
++ lib.optionals postgresSupport [
libpq
libpq.pg_config
]
++ lib.optionals stdenv.isDarwin [
cctools
darwin.autoSignDarwinBinariesHook
];

buildInputs = [
gmp
Expand Down
Loading