cli: allow using commands from local flakerefs for debugging

This commit is contained in:
Michael Hoang
2025-06-02 09:42:30 +10:00
parent 0da94c27ca
commit 10b89fe8fd

View File

@@ -119,6 +119,13 @@ class Packages:
else:
allowed_packages = cls.allowed_packages
if "#" in package:
log.warning(
"Allowing package %s for debugging as it looks like a flakeref",
package,
)
return
if package not in allowed_packages:
msg = f"Package not allowed: '{package}', allowed packages are:\n{'\n'.join(allowed_packages)}"
raise ClanError(msg)
@@ -133,6 +140,9 @@ class Packages:
os.environ.get("CLAN_PROVIDED_PACKAGES", "").split(":")
)
if "#" in program:
return True
if program in cls.static_packages:
if shutil.which(program) is None:
log.warning(
@@ -157,7 +167,7 @@ def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
f"nixpkgs#{package}"
for package in packages
if not Packages.is_provided(package)
]
] + [package for package in packages if "#" in package]
if not missing_packages:
return cmd
return [