use packaged nixos-facter in generate_hardware_info

This commit is contained in:
Jörg Thalheim
2024-09-20 13:34:15 +02:00
parent bd383a9f35
commit 5b878ac8ac

View File

@@ -117,13 +117,16 @@ def generate_machine_hardware_info(
if hostname is not None: if hostname is not None:
machine.target_host_address = hostname machine.target_host_address = hostname
nixos_generate_cmd = [ config_command = (
"nixos-generate-config", # Filesystems are managed by disko ["nixos-facter"]
if report_type == "nixos-facter"
else [
"nixos-generate-config",
# Filesystems are managed by disko
"--no-filesystems", "--no-filesystems",
"--show-hardware-config", "--show-hardware-config",
] ]
)
nixos_facter_cmd = ["nix", "run", "--refresh", "github:numtide/nixos-facter"]
host = machine.target_host host = machine.target_host
target_host = f"{host.user or 'root'}@{host.host}" target_host = f"{host.user or 'root'}@{host.host}"
@@ -148,11 +151,7 @@ def generate_machine_hardware_info(
else [] else []
), ),
target_host, target_host,
*( *config_command,
nixos_generate_cmd
if report_type == "nixos-generate-config"
else nixos_facter_cmd
),
], ],
) )
out = run(cmd) out = run(cmd)