Skip to content

Commit f214975

Browse files
pogobananeMic92
authored andcommitted
nixos-anywhere-pxe: fix nixos-anywhere path
works for development and with nix package
1 parent 0e05582 commit f214975

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/nixos_anywhere_pxe/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818

1919
FILE = Union[None, int, IO]
2020

21-
NIXOS_ANYWHERE_SH = Path(__file__).parent.absolute() / "src/nixos-anywhere.sh"
22-
21+
# use nixos-anywhere if available, else use unpackaged shell script for development
22+
NIXOS_ANYWHERE_SH = shutil.which("nixos-anywhere")
23+
if NIXOS_ANYWHERE_SH is not None:
24+
# i prefer not having huge nix-store paths in the logs
25+
NIXOS_ANYWHERE_SH = "nixos-anywhere"
26+
else:
27+
NIXOS_ANYWHERE_SH = Path(__file__).parent.absolute() / "src/nixos-anywhere.sh"
2328

2429

2530
def run(

0 commit comments

Comments
 (0)