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
This commit is contained in:
Joseph Goulden
2025-11-11 13:24:17 +00:00
committed by Rusty Russell
parent f58079e559
commit 1ead6791fd
6 changed files with 108 additions and 78 deletions

View File

@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 30 timeout-minutes: 30
if: | if: |
github.event.action != 'edited' || github.event.action != 'edited' ||
contains(github.event.pull_request.body, 'Changelog') contains(github.event.pull_request.body, 'Changelog')
env: env:
BOLTDIR: bolts BOLTDIR: bolts
@@ -596,6 +596,25 @@ jobs:
cat config.vars cat config.vars
VALGRIND=0 uv run eatmydata pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS} 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: gather:
# A dummy task that depends on the full matrix of tests, and # A dummy task that depends on the full matrix of tests, and
# signals successful completion. Used for the PR status to pass # signals successful completion. Used for the PR status to pass

View File

@@ -64,8 +64,6 @@ 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 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.

63
flake.lock generated
View File

@@ -3,11 +3,11 @@
"advisory-db": { "advisory-db": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1727353582, "lastModified": 1750151065,
"narHash": "sha256-2csMEEOZhvowVKZNBHk1kMJqk72ZMrPj9LQYCzP6EKs=", "narHash": "sha256-il+CAqChFIB82xP6bO43dWlUVs+NlG7a4g8liIP5HcI=",
"owner": "rustsec", "owner": "rustsec",
"repo": "advisory-db", "repo": "advisory-db",
"rev": "cb905e6e405834bdff1eb1e20c9b10edb5403889", "rev": "7573f55ba337263f61167dbb0ea926cdc7c8eb5d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -18,11 +18,11 @@
}, },
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1727316705, "lastModified": 1750266157,
"narHash": "sha256-/mumx8AQ5xFuCJqxCIOFCHTVlxHkMT21idpbgbm/TIE=", "narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "5b03654ce046b5167e7b0bccbd8244cb56c16f0e", "rev": "e37c943371b73ed87faf33f7583860f81f1d5a48",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -36,11 +36,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1726153070, "lastModified": 1749398372,
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -51,45 +51,32 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1727540905, "lastModified": 1761373498,
"narHash": "sha256-40J9tW7Y794J7Uw4GwcAKlMxlX2xISBl6IBigo83ih8=", "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fbca5e745367ae7632731639de5c21f29c8744ed", "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-24.05", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1725233747, "lastModified": 1748740939,
"narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=",
"type": "tarball", "owner": "nix-community",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" "repo": "nixpkgs.lib",
}, "rev": "656a64127e9d791a334452c6b6606d17539476e2",
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726871744,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nix-community",
"ref": "nixpkgs-unstable", "repo": "nixpkgs.lib",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
@@ -104,14 +91,16 @@
}, },
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1727431250, "lastModified": 1761311587,
"narHash": "sha256-uGRlRT47ecicF9iLD1G3g43jn2e+b5KaMptb59LHnvM=", "narHash": "sha256-Msq86cR5SjozQGCnC6H8C+0cD4rnx91BPltZ9KK613Y=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "879b29ae9a0378904fbbefe0dadaed43c8905754", "rev": "2eddae033e4e74bf581c2d1dfa101f9033dbd2dc",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -2,18 +2,23 @@
description = "Core Lightning (CLN): A specification compliant Lightning Network implementation in C"; description = "Core Lightning (CLN): A specification compliant Lightning Network implementation in C";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
crane.url = "github:ipetkov/crane"; 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 = { advisory-db = {
url = "github:rustsec/advisory-db"; url = "github:rustsec/advisory-db";
flake = false; flake = false;
}; };
self.submodules = true;
}; };
outputs = outputs =
@@ -29,6 +34,7 @@
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
./nix/pkgs/flake-module.nix ./nix/pkgs/flake-module.nix
./nix/checks/flake-module.nix ./nix/checks/flake-module.nix
./nix/apps.nix
./nix/shells.nix ./nix/shells.nix
./nix/treefmt.nix ./nix/treefmt.nix
]; ];
@@ -45,20 +51,6 @@
inherit system; inherit system;
overlays = [ (final: prev: { craneLib = (inputs.crane.mkLib pkgs); }) ]; 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
nix/apps.nix Normal file
View File

@@ -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";
};
};
};
}

View File

@@ -26,26 +26,27 @@ stdenv.mkDerivation {
# when building on darwin we need cctools to provide the correct libtool # 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 # 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. # option to libtool, also we have to add the modified gsed package.
nativeBuildInputs = nativeBuildInputs = [
[ autoconf
autoconf autogen
autogen automake
automake gettext
gettext gitMinimal
gitMinimal libtool
postgresql lowdown
libtool pkgconf
lowdown py3
pkgconf unzip
py3 which
unzip ]
which ++ lib.optionals postgresSupport [
] libpq
++ lib.optionals postgresSupport [ postgresql ] libpq.pg_config
++ lib.optionals stdenv.isDarwin [ ]
cctools ++ lib.optionals stdenv.isDarwin [
darwin.autoSignDarwinBinariesHook cctools
]; darwin.autoSignDarwinBinariesHook
];
buildInputs = [ buildInputs = [
gmp gmp