mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/esphome: init module
This commit is contained in:
parent
8da0c39903
commit
8df62ec46c
5 changed files with 181 additions and 0 deletions
41
nixos/tests/esphome.nix
Normal file
41
nixos/tests/esphome.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
import ./make-test-python.nix ({ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
testPort = 6052;
|
||||
unixSocket = "/run/esphome/esphome.sock";
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
name = "esphome";
|
||||
meta.maintainers = with pkgs.lib.maintainers; [ oddlama ];
|
||||
|
||||
nodes = {
|
||||
esphomeTcp = { ... }:
|
||||
{
|
||||
services.esphome = {
|
||||
enable = true;
|
||||
port = testPort;
|
||||
address = "0.0.0.0";
|
||||
openFirewall = true;
|
||||
};
|
||||
};
|
||||
|
||||
esphomeUnix = { ... }:
|
||||
{
|
||||
services.esphome = {
|
||||
enable = true;
|
||||
enableUnixSocket = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
esphomeTcp.wait_for_unit("esphome.service")
|
||||
esphomeTcp.wait_for_open_port(${toString testPort})
|
||||
esphomeTcp.succeed("curl --fail http://localhost:${toString testPort}/")
|
||||
|
||||
esphomeUnix.wait_for_unit("esphome.service")
|
||||
esphomeUnix.wait_for_file("${unixSocket}")
|
||||
esphomeUnix.succeed("curl --fail --unix-socket ${unixSocket} http://localhost/")
|
||||
'';
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue