cli: resolve CLAN_NIXPKGS on every invocation

this makes mocking easier
This commit is contained in:
Jörg Thalheim
2023-07-26 08:17:37 +02:00
committed by Mic92
parent 9aa75336b7
commit 72f6b368d6

View File

@@ -1,10 +1,9 @@
import os
CLAN_NIXPKGS = os.environ.get("CLAN_NIXPKGS")
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
nixpkgs = os.environ.get("CLAN_NIXPKGS")
# in unittest we will have all binaries provided
if CLAN_NIXPKGS is None:
if nixpkgs is None:
return cmd
return ["nix", "shell", "-f", CLAN_NIXPKGS] + packages + ["-c"] + cmd
return ["nix", "shell", "-f", nixpkgs] + packages + ["-c"] + cmd