Merge pull request 'Templates/default: move clan configuration into its own file' (#4262) from templates into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4262
This commit is contained in:
@@ -2,17 +2,17 @@ import argparse
|
||||
import logging
|
||||
|
||||
from clan_lib.clan.get import get_clan_details
|
||||
from clan_lib.flake import Flake
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def show_command(args: argparse.Namespace) -> None:
|
||||
flake_path = args.flake.path
|
||||
meta = get_clan_details(flake_path)
|
||||
flake: Flake = args.flake
|
||||
meta = get_clan_details(flake)
|
||||
|
||||
print(f"Name: {meta.get('name')}")
|
||||
print(f"Description: {meta.get('description', '-')}")
|
||||
print(f"Icon: {meta.get('icon', '-')}")
|
||||
|
||||
|
||||
def register_parser(parser: argparse.ArgumentParser) -> None:
|
||||
|
||||
@@ -64,8 +64,6 @@ def test_clan_core_templates(
|
||||
assert (flake_nix).exists()
|
||||
assert (flake_nix).is_file()
|
||||
|
||||
assert (my_clan / "machines").is_dir()
|
||||
|
||||
# Test if we can write to the flake.nix file
|
||||
with flake_nix.open("r+") as f:
|
||||
data = f.read()
|
||||
|
||||
@@ -23,7 +23,6 @@ def test_create_flake(
|
||||
|
||||
cli.run(["flakes", "create", str(flake_dir), "--template=default", "--no-update"])
|
||||
|
||||
assert (flake_dir / ".clan-flake").exists()
|
||||
# Replace the inputs.clan.url in the template flake.nix
|
||||
substitute(
|
||||
flake_dir / "flake.nix",
|
||||
@@ -37,10 +36,10 @@ def test_create_flake(
|
||||
|
||||
# create a hardware-configuration.nix that doesn't throw an eval error
|
||||
|
||||
for patch_machine in ["jon", "sara"]:
|
||||
(
|
||||
flake_dir / "machines" / f"{patch_machine}/hardware-configuration.nix"
|
||||
).write_text("{}")
|
||||
# for patch_machine in ["jon", "sara"]:
|
||||
# (
|
||||
# flake_dir / "machines" / f"{patch_machine}/hardware-configuration.nix"
|
||||
# ).write_text("{}")
|
||||
|
||||
with capture_output as output:
|
||||
cli.run(["machines", "list"])
|
||||
@@ -68,7 +67,6 @@ def test_create_flake_existing_git(
|
||||
|
||||
cli.run(["flakes", "create", str(flake_dir), "--template=default", "--no-update"])
|
||||
|
||||
assert (flake_dir / ".clan-flake").exists()
|
||||
# Replace the inputs.clan.url in the template flake.nix
|
||||
substitute(
|
||||
flake_dir / "flake.nix",
|
||||
@@ -81,10 +79,10 @@ def test_create_flake_existing_git(
|
||||
|
||||
# create a hardware-configuration.nix that doesn't throw an eval error
|
||||
|
||||
for patch_machine in ["jon", "sara"]:
|
||||
(
|
||||
flake_dir / "machines" / f"{patch_machine}/hardware-configuration.nix"
|
||||
).write_text("{}")
|
||||
# for patch_machine in ["jon", "sara"]:
|
||||
# (
|
||||
# flake_dir / "machines" / f"{patch_machine}/hardware-configuration.nix"
|
||||
# ).write_text("{}")
|
||||
|
||||
with capture_output as output:
|
||||
cli.run(["machines", "list"])
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# subdir = temporary_home / "subdir"
|
||||
# subdir.mkdir()
|
||||
# monkeypatch.chdir(subdir)
|
||||
# (subdir / ".clan-flake").touch()
|
||||
# assert _get_clan_flake_toplevel() == subdir
|
||||
|
||||
from clan_lib.dirs import clan_key_safe, vm_state_dir
|
||||
|
||||
Reference in New Issue
Block a user