Start using Nix as a reproducible build tool

This commit is contained in:
matthewcroughan 2022-07-08 09:51:21 +01:00
parent 36e92765d3
commit 6aa8330dc3
5 changed files with 267 additions and 0 deletions

4
nix/tests/default.nix Normal file
View file

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

View file

@ -0,0 +1,25 @@
{ pkgs, makeTest, inputs }:
makeTest {
nodes = {
client = { config, pkgs, ... }: {
environment.systemPackages = [ pkgs.curl ];
};
lnbits = { ... }: {
imports = [ inputs.self.nixosModules.${pkgs.hostPlatform.system}.default ];
services.lnbits = {
enable = true;
openFirewall = true;
host = "0.0.0.0";
};
};
};
testScript = { nodes, ... }: ''
start_all()
lnbits.wait_for_open_port(${toString nodes.lnbits.config.services.lnbits.port})
client.wait_for_unit("multi-user.target")
with subtest("Check that the lnbits webserver can be reached."):
assert "<title>LNbits</title>" in client.succeed(
"curl -sSf http:/lnbits:8231/ | grep title"
)
'';
}