Revert "remove nix_shell_legacy"

This reverts commit f3512b853a.
This commit is contained in:
Johannes Kirschbauer
2025-04-18 14:47:37 +02:00
parent 02720a503d
commit c5001f19fc
24 changed files with 119 additions and 91 deletions

View File

@@ -105,6 +105,24 @@ def nix_metadata(flake_url: str | Path) -> dict[str, Any]:
return data
# Deprecated: use nix_shell() instead
def nix_shell_legacy(packages: list[str], cmd: list[str]) -> list[str]:
# we cannot use nix-shell inside the nix sandbox
# in our tests we just make sure we have all the packages
if (
os.environ.get("IN_NIX_SANDBOX")
or os.environ.get("CLAN_NO_DYNAMIC_DEPS")
or len(packages) == 0
):
return cmd
return [
*nix_command(["shell", "--inputs-from", f"{nixpkgs_flake()!s}"]),
*packages,
"-c",
*cmd,
]
# lazy loads list of allowed and static programs
class Packages:
allowed_packages: set[str] | None = None
@@ -134,6 +152,7 @@ class Packages:
return program in cls.static_packages
# Alternative implementation of nix_shell() to replace nix_shell_legacy() at some point
# Features:
# - allow list for programs (need to be specified in allowed-packages.json)
# - be abe to compute a closure of all deps for testing

View File

@@ -3,14 +3,12 @@
"avahi",
"bash",
"bubblewrap",
"disko",
"e2fsprogs",
"git",
"gnupg",
"mypy",
"netcat",
"nix",
"nixos-anywhere",
"openssh",
"pass",
"qemu",
@@ -20,8 +18,6 @@
"sshpass",
"tor",
"util-linux",
"virt-viewer",
"virtiofsd",
"waypipe",
"zbar"
]