docs: Fix nix flake check problem with diskId
This commit is contained in:
@@ -199,21 +199,6 @@ If you only want to setup a single machine at this point, you can delete `sara`
|
|||||||
git rm ./machines/sara
|
git rm ./machines/sara
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 5: Check Configuration
|
|
||||||
|
|
||||||
Validate your configuration by running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix flake check
|
|
||||||
```
|
|
||||||
|
|
||||||
This command helps ensure that your system configuration is correct and free from errors.
|
|
||||||
|
|
||||||
!!! Tip
|
|
||||||
|
|
||||||
You can integrate this step into your [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) workflow to ensure that only valid Nix configurations are merged into your codebase.
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Whats next?
|
## Whats next?
|
||||||
|
|||||||
@@ -55,7 +55,35 @@ sops/
|
|||||||
```
|
```
|
||||||
If you followed the quickstart tutorial all necessary secrets are initialized at this point.
|
If you followed the quickstart tutorial all necessary secrets are initialized at this point.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
### Generate Facts and Vars
|
||||||
|
|
||||||
|
Typically, this step is handled automatically when a machine is deployed. However, to enable the use of `nix flake check` with your configuration, it must be completed manually beforehand.
|
||||||
|
|
||||||
|
Currently, generating all the necessary facts requires two separate commands. This is due to the coexistence of two parallel secret management solutions: the older, stable version (`clan secrets` and `clan facts`) and the newer, experimental version (`clan vars`).
|
||||||
|
|
||||||
|
To generate both facts and vars, execute the following commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
clan facts generate && clan vars generate
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Check Configuration
|
||||||
|
|
||||||
|
Validate your configuration by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix flake check
|
||||||
|
```
|
||||||
|
|
||||||
|
This command helps ensure that your system configuration is correct and free from errors.
|
||||||
|
|
||||||
|
!!! Tip
|
||||||
|
|
||||||
|
You can integrate this step into your [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) workflow to ensure that only valid Nix configurations are merged into your codebase.
|
||||||
|
|
||||||
|
|
||||||
## Whats next?
|
## Whats next?
|
||||||
|
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ def _generate_facts_for_machine(
|
|||||||
|
|
||||||
def generate_facts(
|
def generate_facts(
|
||||||
machines: list[Machine],
|
machines: list[Machine],
|
||||||
service: str | None,
|
service: str | None = None,
|
||||||
regenerate: bool,
|
regenerate: bool = False,
|
||||||
prompt: Callable[[str, str], str] = prompt_func,
|
prompt: Callable[[str, str], str] = prompt_func,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
was_regenerated = False
|
was_regenerated = False
|
||||||
@@ -212,7 +212,7 @@ def generate_facts(
|
|||||||
)
|
)
|
||||||
raise ClanError(msg)
|
raise ClanError(msg)
|
||||||
|
|
||||||
if not was_regenerated:
|
if not was_regenerated and len(machines) > 0:
|
||||||
machine.info("All secrets and facts are already up to date")
|
machine.info("All secrets and facts are already up to date")
|
||||||
return was_regenerated
|
return was_regenerated
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ def flash_machine(
|
|||||||
generate_vars_for_machine(
|
generate_vars_for_machine(
|
||||||
machine, generator_name=None, regenerate=False, fix=False
|
machine, generator_name=None, regenerate=False, fix=False
|
||||||
)
|
)
|
||||||
generate_facts([machine], service=None, regenerate=False)
|
generate_facts([machine])
|
||||||
|
|
||||||
if system_config.wifi_settings:
|
if system_config.wifi_settings:
|
||||||
wifi_settings: dict[str, dict[str, str]] = {}
|
wifi_settings: dict[str, dict[str, str]] = {}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ def install_machine(opts: InstallOptions) -> None:
|
|||||||
target_host = f"{h.user or 'root'}@{h.host}"
|
target_host = f"{h.user or 'root'}@{h.host}"
|
||||||
log.info(f"target host: {target_host}")
|
log.info(f"target host: {target_host}")
|
||||||
|
|
||||||
generate_facts([machine], None, False)
|
generate_facts([machine])
|
||||||
generate_vars([machine], None, False)
|
generate_vars([machine])
|
||||||
|
|
||||||
with TemporaryDirectory(prefix="nixos-install-") as tmpdir_:
|
with TemporaryDirectory(prefix="nixos-install-") as tmpdir_:
|
||||||
tmpdir = Path(tmpdir_)
|
tmpdir = Path(tmpdir_)
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ def deploy_machine(machines: MachineGroup) -> None:
|
|||||||
|
|
||||||
def deploy(machine: Machine) -> None:
|
def deploy(machine: Machine) -> None:
|
||||||
host = machine.build_host
|
host = machine.build_host
|
||||||
generate_facts([machine], None, False)
|
generate_facts([machine])
|
||||||
generate_vars([machine], None, False)
|
generate_vars([machine])
|
||||||
|
|
||||||
upload_secrets(machine)
|
upload_secrets(machine)
|
||||||
upload_secret_vars(machine)
|
upload_secret_vars(machine)
|
||||||
|
|||||||
@@ -405,8 +405,8 @@ def generate_vars_for_machine(
|
|||||||
|
|
||||||
def generate_vars(
|
def generate_vars(
|
||||||
machines: list[Machine],
|
machines: list[Machine],
|
||||||
generator_name: str | None,
|
generator_name: str | None = None,
|
||||||
regenerate: bool,
|
regenerate: bool = False,
|
||||||
fix: bool = False,
|
fix: bool = False,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
was_regenerated = False
|
was_regenerated = False
|
||||||
@@ -424,7 +424,7 @@ def generate_vars(
|
|||||||
msg = f"Failed to generate facts for {len(errors)} hosts. Check the logs above"
|
msg = f"Failed to generate facts for {len(errors)} hosts. Check the logs above"
|
||||||
raise ClanError(msg) from errors[0]
|
raise ClanError(msg) from errors[0]
|
||||||
|
|
||||||
if not was_regenerated:
|
if not was_regenerated and len(machines) > 0:
|
||||||
machine.info("All vars are already up to date")
|
machine.info("All vars are already up to date")
|
||||||
|
|
||||||
return was_regenerated
|
return was_regenerated
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def get_secrets(
|
|||||||
secret_facts_module = importlib.import_module(machine.secret_facts_module)
|
secret_facts_module = importlib.import_module(machine.secret_facts_module)
|
||||||
secret_facts_store = secret_facts_module.SecretStore(machine=machine)
|
secret_facts_store = secret_facts_module.SecretStore(machine=machine)
|
||||||
|
|
||||||
generate_facts([machine], None, False)
|
generate_facts([machine])
|
||||||
|
|
||||||
secret_facts_store.upload(secrets_dir)
|
secret_facts_store.upload(secrets_dir)
|
||||||
return secrets_dir
|
return secrets_dir
|
||||||
|
|||||||
Reference in New Issue
Block a user