Build clboss package with nix flake

This commit is contained in:
Joseph Goulden 2025-12-15 20:51:10 +00:00 committed by Ken Sedgwick
parent 3b3f4b7851
commit 67c2f86cca
No known key found for this signature in database
GPG key ID: DBD2AF0849D711A9
6 changed files with 92 additions and 47 deletions

View file

@ -7,11 +7,11 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix develop --command bash -c "autoreconf -i && ./configure && make -j4 distcheck"
- run: nix flake check
coverage:
runs-on: ubuntu-latest

2
.gitignore vendored
View file

@ -47,3 +47,5 @@ coverage-html/
*.gcno
*.gcov
*.gcov.json.gz
result

View file

@ -1,6 +1,8 @@
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz";
}) {} }:
{
pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz";
}) { },
}:
let
poetry2nix = import (builtins.fetchGit {
@ -16,4 +18,3 @@ pkgs.mkShell {
})
];
}

11
flake.lock generated
View file

@ -20,15 +20,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1692270513,
"narHash": "sha256-xu23SOtq8DhqbFzyr+z89xUMh12J/10eyXrih1ifwq4=",
"owner": "nixos",
"lastModified": 1759831965,
"narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1abef55f64479d6fcd2c309a00a5ff419e793a85",
"rev": "c9b6fb798541223bbb396d287d16f43520250518",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -3,38 +3,79 @@
nixConfig.bash-prompt = "\[nix-develop\]$ ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages = {
default = pkgs.neofetch;
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
nativeBuildInputs = [
pkgs.autoconf-archive
pkgs.autoreconfHook
pkgs.pkg-config
pkgs.libev
pkgs.libunwind
pkgs.curlWithGnuTls
pkgs.sqlite
];
clboss = pkgs.stdenv.mkDerivation {
name = "clboss";
src = ./.;
inherit nativeBuildInputs;
enableParallelBuilding = true;
preBuild = ''
./generate_commit_hash.sh
'';
doCheck = false;
meta = with pkgs.lib; {
description = "Automated Core Lightning Node Manager";
homepage = "https://github.com/ZmnSCPxj/clboss";
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
mainProgram = "clboss";
};
};
in
{
packages.default = clboss;
checks.default = clboss.overrideAttrs (old: {
doCheck = true;
checkPhase = ''
make -j4 distcheck
'';
});
formatter = pkgs.nixfmt-tree;
formatter = pkgs.nixpkgs-fmt;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
gcc
pkg-config
libev
libevdev
curl
libunwind
sqlite
bind
autoconf
autoconf-archive
libtool
automake
git
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs;
buildInputs =
with pkgs;
nativeBuildInputs
++ [
gcc
libevdev
bind
autoconf
autoconf-archive
libtool
automake
git
# editor support
bear
];
# editor support
bear
];
};
}
);

View file

@ -1,12 +1,12 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }
# Since a lot of existing CI tests is based on `shell.nix`
# we forward to the integrationTests shell, instead of the
# default (developer) shell.