uvms: init app urls, kinda
This commit is contained in:
parent
f8cc57f146
commit
42fca62474
1 changed files with 16 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import json
|
||||||
import re
|
import re
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from contextlib import contextmanager, closing, ExitStack
|
from contextlib import contextmanager, closing, ExitStack
|
||||||
|
from urllib import urlparse
|
||||||
|
|
||||||
|
|
||||||
parser = ArgumentParser("supervise-vm")
|
parser = ArgumentParser("supervise-vm")
|
||||||
|
|
@ -517,11 +518,24 @@ def main(args, args_next, cleanup, ps):
|
||||||
|
|
||||||
app_paths = []
|
app_paths = []
|
||||||
for a in args.app:
|
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(
|
out_path = ps.exec(
|
||||||
"nix-build",
|
"nix-build",
|
||||||
"<nixpkgs>",
|
nix_file,
|
||||||
"-A",
|
"-A",
|
||||||
a,
|
attr,
|
||||||
"--no-out-link",
|
"--no-out-link",
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue