nix: Re-enable and fix basic nix flake check for nix package and module (#3425)

Co-authored-by: Weston Keele <wekeele@proton.me>
This commit is contained in:
Weston Keele (whisky)
2025-10-29 14:58:43 +00:00
committed by GitHub
parent 248fcc06ab
commit 26780df065
3 changed files with 14 additions and 8 deletions

View File

@@ -145,6 +145,7 @@
nixpkgs.overlays = [ self.overlays.${system}.default ]; nixpkgs.overlays = [ self.overlays.${system}.default ];
}; };
checks = { }; checks =
import ./nix/tests { inherit pkgs; flake = self; };
}); });
} }

View File

@@ -1,4 +1,4 @@
{ pkgs, makeTest, inputs }: { pkgs, flake }:
{ {
vmTest = import ./nixos-module { inherit pkgs makeTest inputs; }; vmTest = import ./nixos-module { inherit pkgs flake; };
} }

View File

@@ -1,16 +1,19 @@
{ pkgs, makeTest, inputs }: { pkgs, flake }:
makeTest { pkgs.nixosTest {
name = "lnbits-nixos-module"; name = "lnbits-nixos-module";
nodes = { nodes = {
client = { config, pkgs, ... }: { client = { config, pkgs, ... }: {
environment.systemPackages = [ pkgs.curl ]; environment.systemPackages = [ pkgs.curl ];
}; };
lnbits = { ... }: { lnbits = { ... }: {
imports = [ inputs.self.nixosModules.default ]; imports = [ flake.nixosModules.${pkgs.system}.default ];
services.lnbits = { services.lnbits = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
host = "0.0.0.0"; host = "0.0.0.0";
env = {
LNBITS_ADMIN_UI = "false";
};
}; };
}; };
}; };
@@ -19,8 +22,10 @@ makeTest {
lnbits.wait_for_open_port(${toString nodes.lnbits.config.services.lnbits.port}) lnbits.wait_for_open_port(${toString nodes.lnbits.config.services.lnbits.port})
client.wait_for_unit("multi-user.target") client.wait_for_unit("multi-user.target")
with subtest("Check that the lnbits webserver can be reached."): with subtest("Check that the lnbits webserver can be reached."):
assert "<title>LNbits</title>" in client.succeed( output = client.succeed(
"curl -sSf http:/lnbits:8231/ | grep title" "curl -sSf http://lnbits:8231/ | grep title | head -n1"
) )
assert "<title>LNbits</title>" in output;
''; '';
} }