clan-cli: Remove unecessary nix_options args from functions

This commit is contained in:
Qubasa
2025-06-24 19:07:41 +02:00
parent f3305a968d
commit cb2097c1e5
5 changed files with 11 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
import logging
import os
from dataclasses import dataclass, field
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -32,7 +32,6 @@ class InstallOptions:
no_reboot: bool = False
phases: str | None = None
build_on: BuildOn | None = None
nix_options: list[str] = field(default_factory=list)
update_hardware_config: HardwareConfig = HardwareConfig.NONE
password: str | None = None
identity_file: Path | None = None
@@ -127,7 +126,7 @@ def install_machine(opts: InstallOptions, target_host: Remote) -> None:
cmd.append("--debug")
# Add nix options to nixos-anywhere
cmd.extend(opts.nix_options)
cmd.extend(opts.machine.flake.nix_options or [])
cmd.append(target_host.target)
if opts.use_tor:

View File

@@ -162,14 +162,11 @@ class Machine:
def nix(
self,
attr: str,
nix_options: list[str] | None = None,
) -> Any:
"""
Build the machine and return the path to the result
accepts a secret store and a facts store # TODO
"""
if nix_options is None:
nix_options = []
config = nix_config()
system = config["system"]
@@ -178,12 +175,7 @@ class Machine:
f'clanInternals.machines."{system}"."{self.name}".{attr}'
)
def eval_nix(
self,
attr: str,
extra_config: None | dict = None,
nix_options: list[str] | None = None,
) -> Any:
def eval_nix(self, attr: str, extra_config: None | dict = None) -> Any:
"""
eval a nix attribute of the machine
@attr: the attribute to get
@@ -192,17 +184,9 @@ class Machine:
if extra_config:
log.warning("extra_config in eval_nix is no longer supported")
if nix_options is None:
nix_options = []
return self.nix(attr)
return self.nix(attr, nix_options)
def build_nix(
self,
attr: str,
extra_config: None | dict = None,
nix_options: list[str] | None = None,
) -> Path:
def build_nix(self, attr: str, extra_config: None | dict = None) -> Path:
"""
build a nix attribute of the machine
@attr: the attribute to get
@@ -211,10 +195,7 @@ class Machine:
if extra_config:
log.warning("extra_config in build_nix is no longer supported")
if nix_options is None:
nix_options = []
output = self.nix(attr, nix_options)
output = self.nix(attr)
output = Path(output)
if tmp_store := nix_test_store():
output = tmp_store.joinpath(*output.parts[1:])