add task to build nixos machines locally

this is also useful for people that do not have access to the
servers (i.e. as part of a PR).
This commit is contained in:
Jörg Thalheim 2022-12-19 15:39:59 +01:00
parent d57601e4cb
commit c787d3dd4c

View file

@ -164,6 +164,29 @@ def deploy(c, hosts=""):
deploy_nixos(get_hosts(hosts))
@task
def build_local(c, hosts=""):
"""
Build all servers. Use inv build-local --host build01 to build a single server
"""
g = DeployGroup(get_hosts(hosts))
def build_local(h: DeployHost) -> None:
h.run_local(
[
"nixos-rebuild",
"build",
"--option",
"accept-flake-config",
"true",
"--flake",
f".#{h.host}",
]
)
g.run_function(build_local)
def wait_for_port(host: str, port: int, shutdown: bool = False) -> None:
import socket, time