uvms: init app urls, kinda

This commit is contained in:
Else Someone 2026-03-11 17:39:00 +02:00
parent f8cc57f146
commit 42fca62474

View file

@ -13,6 +13,7 @@ import json
import re
from argparse import ArgumentParser
from contextlib import contextmanager, closing, ExitStack
from urllib import urlparse
parser = ArgumentParser("supervise-vm")
@ -517,11 +518,24 @@ def main(args, args_next, cleanup, ps):
app_paths = []
for a in args.app:
a = urlparse(a)
nix_file = None
attr = None
if a.scheme == "":
nix_file = "<nixpkgs>"
attr = a.path
elif a.scheme == "getexe":
nix_file = a.netloc or "./."
attr = a.path.lstrip("/")
else:
raise RuntimeError("Unknown app url", a)
assert nix_file is not None, a
assert attr is not None, a
out_path = ps.exec(
"nix-build",
"<nixpkgs>",
nix_file,
"-A",
a,
attr,
"--no-out-link",
capture_output=True,
text=True,