clan-cli: clan_cli.templates -> clan_lib.templates

This commit is contained in:
lassulus
2025-05-20 15:13:21 +02:00
parent 1f0c355175
commit 03990ef7f0
8 changed files with 16 additions and 17 deletions

View File

@@ -11,8 +11,7 @@ from clan_lib.flake import Flake
from clan_lib.nix import nix_command, nix_metadata, nix_shell from clan_lib.nix import nix_command, nix_metadata, nix_shell
from clan_lib.nix_models.inventory import Inventory from clan_lib.nix_models.inventory import Inventory
from clan_lib.persist.inventory_store import InventoryStore from clan_lib.persist.inventory_store import InventoryStore
from clan_lib.templates import (
from clan_cli.templates import (
InputPrio, InputPrio,
TemplateName, TemplateName,
copy_from_nixstore, copy_from_nixstore,

View File

@@ -1,7 +1,7 @@
import argparse import argparse
import logging import logging
from clan_cli.templates import list_templates from clan_lib.templates import list_templates
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@@ -17,16 +17,16 @@ from clan_lib.nix_models.inventory import (
) )
from clan_lib.persist.inventory_store import InventoryStore from clan_lib.persist.inventory_store import InventoryStore
from clan_lib.persist.util import apply_patch from clan_lib.persist.util import apply_patch
from clan_lib.templates import (
from clan_cli.completions import add_dynamic_completer, complete_tags
from clan_cli.machines.list import list_machines
from clan_cli.templates import (
InputPrio, InputPrio,
TemplateName, TemplateName,
copy_from_nixstore, copy_from_nixstore,
get_template, get_template,
) )
from clan_cli.completions import add_dynamic_completer, complete_tags
from clan_cli.machines.list import list_machines
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@@ -5,7 +5,13 @@ from pathlib import Path
from typing import Any from typing import Any
import pytest import pytest
from clan_cli.templates import ( from clan_cli.tests.fixtures_flakes import FlakeForTest
from clan_lib.cmd import run
from clan_lib.flake import Flake
from clan_lib.git import commit_file
from clan_lib.locked_open import locked_open
from clan_lib.nix import nix_command
from clan_lib.templates import (
ClanExports, ClanExports,
InputName, InputName,
TemplateName, TemplateName,
@@ -14,12 +20,6 @@ from clan_cli.templates import (
get_template, get_template,
list_templates, list_templates,
) )
from clan_cli.tests.fixtures_flakes import FlakeForTest
from clan_lib.cmd import run
from clan_lib.flake import Flake
from clan_lib.git import commit_file
from clan_lib.locked_open import locked_open
from clan_lib.nix import nix_command
# Function to write clan attributes to a file # Function to write clan attributes to a file

View File

@@ -65,7 +65,7 @@ def clan_templates(template_type: TemplateType | None = None) -> Path:
if template_path.exists(): if template_path.exists():
return template_path return template_path
template_path = module_root() / "templates" template_path = module_root() / "clan_core_templates"
if template_type is not None: if template_type is not None:
template_path /= template_type.value template_path /= template_type.value

View File

@@ -73,7 +73,7 @@ let
--replace-fail '@select_hash@' "$(jq -r '.nodes."nix-select".locked.narHash' ${../../flake.lock})" --replace-fail '@select_hash@' "$(jq -r '.nodes."nix-select".locked.narHash' ${../../flake.lock})"
ln -sf ${nixpkgs'} $out/clan_lib/nixpkgs ln -sf ${nixpkgs'} $out/clan_lib/nixpkgs
ln -sf ${nix-select} $out/clan_lib/select ln -sf ${nix-select} $out/clan_lib/select
cp -r ${../../templates} $out/clan_lib/templates cp -r ${../../templates} $out/clan_lib/clan_core_templates
''; '';
sourceWithoutTests = cliSource ( sourceWithoutTests = cliSource (

View File

@@ -21,12 +21,12 @@ exclude = ["clan_lib.nixpkgs*", "result"]
[tool.setuptools.package-data] [tool.setuptools.package-data]
clan_cli = [ clan_cli = [
"py.typed", "py.typed",
"templates/**/*",
"vms/mimetypes/**/*", "vms/mimetypes/**/*",
"webui/assets/**/*", "webui/assets/**/*",
"flash/*.sh", "flash/*.sh",
] ]
clan_lib = [ clan_lib = [
"clan_core_templates/**/*",
"**/allowed-packages.json", "**/allowed-packages.json",
] ]