diff --git a/pkgs/clan-cli/clan_cli/clan/create.py b/pkgs/clan-cli/clan_cli/clan/create.py index afefbdd6f..29cb94a42 100644 --- a/pkgs/clan-cli/clan_cli/clan/create.py +++ b/pkgs/clan-cli/clan_cli/clan/create.py @@ -63,18 +63,11 @@ def create_clan(options: CreateOptions) -> CreateClanResponse: ) out = run(command, cwd=directory) - # Write inventory.json file - inventory = Inventory.load_file(directory) - if options.meta is not None: - inventory.meta = options.meta - + ## Begin: setup git command = nix_shell(["nixpkgs#git"], ["git", "init"]) out = run(command, cwd=directory) cmd_responses["git init"] = out - # Persist also create a commit message for each change - inventory.persist(directory, "Init inventory") - command = nix_shell(["nixpkgs#git"], ["git", "add", "."]) out = run(command, cwd=directory) cmd_responses["git add"] = out @@ -88,6 +81,14 @@ def create_clan(options: CreateOptions) -> CreateClanResponse: ) out = run(command, cwd=directory) cmd_responses["git config"] = out + ## End: setup git + + # Write inventory.json file + inventory = Inventory.load_file(directory) + if options.meta is not None: + inventory.meta = options.meta + # Persist creates a commit message for each change + inventory.persist(directory, "Init inventory") command = ["nix", "flake", "update"] out = run(command, cwd=directory) diff --git a/pkgs/clan-cli/tests/test_vars.py b/pkgs/clan-cli/tests/test_vars.py index bf41ee272..4abeaff69 100644 --- a/pkgs/clan-cli/tests/test_vars.py +++ b/pkgs/clan-cli/tests/test_vars.py @@ -1,6 +1,8 @@ import os from collections import defaultdict +from collections.abc import Callable from pathlib import Path +from typing import Any import pytest from age_keys import SopsSetup @@ -14,7 +16,7 @@ def def_value() -> defaultdict: # allows defining nested dictionary in a single line -nested_dict = lambda: defaultdict(def_value) +nested_dict: Callable[[], dict[str, Any]] = lambda: defaultdict(def_value) @pytest.mark.impure