clan-cli: Remove unecessary nix_options args from functions
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:])
|
||||
|
||||
Reference in New Issue
Block a user