Skip to content

Commit ebcd730

Browse files
pogobananeMic92
authored andcommitted
nixos-anywhere-pxe: fix nixos-anywhere path
works for development and with nix package
1 parent 6d6704c commit ebcd730

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
@@ -21,8 +21,13 @@
2121

2222
FILE = None | int | IO
2323

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

2732

2833
def run(

0 commit comments

Comments
 (0)