Skip to content

Commit 43635a3

Browse files
pogobananeMic92
authored andcommitted
nixos-anywhere-pxe: fix nixos-anywhere path
works for development and with nix package
1 parent e5492b5 commit 43635a3

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
@@ -19,8 +19,13 @@
1919

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

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

2530
def run(
2631
cmd: Union[str, list[str]],

0 commit comments

Comments
 (0)