chore(flake): move 'inputs-from' into templates handling
This commit is contained in:
@@ -568,7 +568,6 @@ class Flake:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
identifier: str
|
identifier: str
|
||||||
inputs_from: str | None = None
|
|
||||||
hash: str | None = None
|
hash: str | None = None
|
||||||
store_path: str | None = None
|
store_path: str | None = None
|
||||||
|
|
||||||
@@ -634,9 +633,6 @@ class Flake:
|
|||||||
self.identifier,
|
self.identifier,
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.inputs_from:
|
|
||||||
cmd += ["--inputs-from", self.inputs_from]
|
|
||||||
|
|
||||||
flake_prefetch = run(nix_command(cmd))
|
flake_prefetch = run(nix_command(cmd))
|
||||||
flake_metadata = json.loads(flake_prefetch.stdout)
|
flake_metadata = json.loads(flake_prefetch.stdout)
|
||||||
self.store_path = flake_metadata["storePath"]
|
self.store_path = flake_metadata["storePath"]
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ from clan_lib.cmd import run
|
|||||||
from clan_lib.dirs import clan_templates
|
from clan_lib.dirs import clan_templates
|
||||||
from clan_lib.errors import ClanCmdError, ClanError
|
from clan_lib.errors import ClanCmdError, ClanError
|
||||||
from clan_lib.flake import Flake
|
from clan_lib.flake import Flake
|
||||||
|
from clan_lib.nix import (
|
||||||
|
nix_command,
|
||||||
|
)
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -202,16 +205,26 @@ def list_templates(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def realize_nix_path(clan_dir: Flake, nix_path: str) -> None:
|
def realize_nix_path(flake: Flake, nix_store_path: str) -> None:
|
||||||
"""
|
"""
|
||||||
Downloads / realizes a nix path into the nix store
|
Downloads / realizes a nix path into the nix store
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if Path(nix_path).exists():
|
if Path(nix_store_path).exists():
|
||||||
return
|
return
|
||||||
|
|
||||||
flake = Flake(identifier=nix_path, inputs_from=clan_dir.identifier)
|
cmd = [
|
||||||
flake.invalidate_cache()
|
"flake",
|
||||||
|
"prefetch",
|
||||||
|
"--inputs-from",
|
||||||
|
flake.identifier,
|
||||||
|
"--option",
|
||||||
|
"flake-registry",
|
||||||
|
"",
|
||||||
|
nix_store_path,
|
||||||
|
]
|
||||||
|
|
||||||
|
run(nix_command(cmd))
|
||||||
|
|
||||||
|
|
||||||
def get_template(
|
def get_template(
|
||||||
|
|||||||
Reference in New Issue
Block a user