Skip to content

Commit eb8298f

Browse files
committed
chore: nix flake update
Switched to nixpkgs-unstable Replaced postgresql dependency with much smaller libpq. Utilise new inputs.self.submodules feature to simplify flake use Moved apps to a separate file Changelog-None
1 parent 2ad1086 commit eb8298f

File tree

6 files changed

+108
-76
lines changed

6 files changed

+108
-76
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,25 @@ jobs:
594594
cat config.vars
595595
VALGRIND=0 uv run eatmydata pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
596596
597+
check-flake:
598+
name: Check Nix Flake
599+
runs-on: ubuntu-22.04
600+
strategy:
601+
fail-fast: true
602+
steps:
603+
- name: Checkout
604+
uses: actions/checkout@v4
605+
with:
606+
submodules: 'recursive'
607+
- name: Check Nix flake inputs
608+
uses: DeterminateSystems/flake-checker-action@v8
609+
- name: Install Nix
610+
uses: cachix/install-nix-action@v31
611+
with:
612+
nix_path: nixpkgs=channel:nixos-25.05
613+
- name: Check flake
614+
run: nix flake check
615+
597616
gather:
598617
# A dummy task that depends on the full matrix of tests, and
599618
# signals successful completion. Used for the PR status to pass

doc/developers-guide/developers-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ The entry point is `flake.nix` in the root of the project, where the inputs and
6262

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

65-
`nix build .?submodules=1` will build the default package (cln).
65+
`nix build` will build the default package (cln).
6666

67-
`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.
67+
`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.
6868

69-
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.
69+
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`.

flake.lock

Lines changed: 26 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22
description = "Core Lightning (CLN): A specification compliant Lightning Network implementation in C";
33

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

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

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

11-
treefmt-nix.url = "github:numtide/treefmt-nix";
11+
treefmt-nix = {
12+
url = "github:numtide/treefmt-nix";
13+
inputs.nixpkgs.follows = "nixpkgs";
14+
};
1215

1316
advisory-db = {
1417
url = "github:rustsec/advisory-db";
1518
flake = false;
1619
};
20+
21+
self.submodules = true;
1722
};
1823

1924
outputs =
@@ -29,6 +34,7 @@
2934
inputs.treefmt-nix.flakeModule
3035
./nix/pkgs/flake-module.nix
3136
./nix/checks/flake-module.nix
37+
./nix/apps.nix
3238
./nix/shells.nix
3339
./nix/treefmt.nix
3440
];
@@ -45,20 +51,6 @@
4551
inherit system;
4652
overlays = [ (final: prev: { craneLib = (inputs.crane.mkLib pkgs); }) ];
4753
};
48-
apps = {
49-
lightningd = {
50-
program = "${self'.packages.cln}/bin/lightningd";
51-
};
52-
lightning-cli = {
53-
program = "${self'.packages.cln}/bin/lightning-cli";
54-
};
55-
lightning-hsmtool = {
56-
program = "${self'.packages.cln}/bin/lightning-hsmtool";
57-
};
58-
reckless = {
59-
program = "${self'.packages.cln}/bin/reckless";
60-
};
61-
};
6254
};
6355
};
6456
}

nix/apps.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{ ... }:
2+
{
3+
perSystem =
4+
{
5+
config,
6+
pkgs,
7+
system,
8+
self',
9+
...
10+
}:
11+
{
12+
apps = {
13+
lightningd = {
14+
program = "${self'.packages.cln}/bin/lightningd";
15+
meta.description = "Core Lightning daemon";
16+
};
17+
lightning-cli = {
18+
program = "${self'.packages.cln}/bin/lightning-cli";
19+
meta.description = "Core Lightning command line interface";
20+
};
21+
lightning-hsmtool = {
22+
program = "${self'.packages.cln}/bin/lightning-hsmtool";
23+
meta.description = "Core Lightning HSM tool";
24+
};
25+
reckless = {
26+
program = "${self'.packages.cln}/bin/reckless";
27+
meta.description = "Core Lightning reckless tool";
28+
};
29+
};
30+
};
31+
}

nix/pkgs/default.nix

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,27 @@ stdenv.mkDerivation {
2626
# when building on darwin we need cctools to provide the correct libtool
2727
# as libwally-core detects the host as darwin and tries to add the -static
2828
# option to libtool, also we have to add the modified gsed package.
29-
nativeBuildInputs =
30-
[
31-
autoconf
32-
autogen
33-
automake
34-
gettext
35-
gitMinimal
36-
postgresql
37-
libtool
38-
lowdown
39-
pkgconf
40-
py3
41-
unzip
42-
which
43-
]
44-
++ lib.optionals postgresSupport [ postgresql ]
45-
++ lib.optionals stdenv.isDarwin [
46-
cctools
47-
darwin.autoSignDarwinBinariesHook
48-
];
29+
nativeBuildInputs = [
30+
autoconf
31+
autogen
32+
automake
33+
gettext
34+
gitMinimal
35+
libtool
36+
lowdown
37+
pkgconf
38+
py3
39+
unzip
40+
which
41+
]
42+
++ lib.optionals postgresSupport [
43+
libpq
44+
libpq.pg_config
45+
]
46+
++ lib.optionals stdenv.isDarwin [
47+
cctools
48+
darwin.autoSignDarwinBinariesHook
49+
];
4950

5051
buildInputs = [
5152
gmp

0 commit comments

Comments
 (0)