nixos-anywhere-pxe: fix nixos-anywhere path

works for development and with nix package
This commit is contained in:
Pogobanane 2023-09-20 10:46:49 +02:00 committed by Jörg Thalheim
parent 0e0558231a
commit f214975b4f

View File

@ -18,8 +18,13 @@ from typing import IO, Iterator, List, NoReturn, Optional, Tuple, Union
FILE = Union[None, int, IO]
NIXOS_ANYWHERE_SH = Path(__file__).parent.absolute() / "src/nixos-anywhere.sh"
# use nixos-anywhere if available, else use unpackaged shell script for development
NIXOS_ANYWHERE_SH = shutil.which("nixos-anywhere")
if NIXOS_ANYWHERE_SH is not None:
# i prefer not having huge nix-store paths in the logs
NIXOS_ANYWHERE_SH = "nixos-anywhere"
else:
NIXOS_ANYWHERE_SH = Path(__file__).parent.absolute() / "src/nixos-anywhere.sh"
def run(