2023-07-26 06:00:07 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
2023-07-26 07:27:48 +00:00
|
|
|
flake = os.environ.get("CLAN_FLAKE")
|
2023-07-26 06:00:07 +00:00
|
|
|
# in unittest we will have all binaries provided
|
2023-07-26 07:27:48 +00:00
|
|
|
if flake is None:
|
2023-07-26 06:00:07 +00:00
|
|
|
return cmd
|
2023-07-26 07:27:48 +00:00
|
|
|
wrapped_packages = [f"path:{flake}#{p}" for p in packages]
|
2023-07-26 07:00:28 +00:00
|
|
|
return ["nix", "shell"] + wrapped_packages + ["-c"] + cmd
|