IT WORKS
This commit is contained in:
parent
da509d97c7
commit
3765e918d6
18 changed files with 348 additions and 226 deletions
|
|
@ -4,7 +4,7 @@ import functools
|
|||
#from pprint import pformat
|
||||
import shlex
|
||||
import textwrap
|
||||
from typing import cast, TYPE_CHECKING
|
||||
from typing import Any, cast, TYPE_CHECKING
|
||||
|
||||
from beartype import beartype
|
||||
|
||||
|
|
@ -68,6 +68,27 @@ def get_cli_args() -> argparse.Namespace:
|
|||
args, rest = parser.parse_known_args(cmdline_args)
|
||||
return args
|
||||
|
||||
@beartype
|
||||
def dynix_append(option: str, value: Any):
|
||||
machine.succeed(f'''
|
||||
dynix append {shlex.quote(option)} {shlex.quote(str(value))}
|
||||
'''.strip())
|
||||
|
||||
@beartype
|
||||
def do_apply():
|
||||
expr = textwrap.dedent("""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> { };
|
||||
in nixos.config.dynamicism.applyDynamicConfiguration {
|
||||
baseConfiguration = /etc/nixos/configuration.nix;
|
||||
newConfiguration = /etc/nixos/dynamic.nix;
|
||||
}
|
||||
""").strip()
|
||||
|
||||
machine.succeed(rf"""
|
||||
nix run --show-trace --log-format raw-with-logs --impure -E {shlex.quote(expr)}
|
||||
""".strip())
|
||||
|
||||
machine.wait_for_unit("default.target")
|
||||
assert "lix" in machine.succeed("nix --version").lower()
|
||||
machine.log("INIT")
|
||||
|
|
@ -89,17 +110,8 @@ args = get_cli_args()
|
|||
#assert int(args['max_connection_rate']) == 256, f"{args['max_connection_rate']=} != 256"
|
||||
#
|
||||
new_jobs = 4
|
||||
expr = textwrap.dedent(f"""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> {{ }};
|
||||
in nixos.config.dynamicism.doChange {{
|
||||
option = "services.distccd.maxJobs";
|
||||
value = {new_jobs};
|
||||
}}
|
||||
""").strip()
|
||||
machine.succeed(rf"""
|
||||
nix run --show-trace --log-format raw-with-logs --impure -E {shlex.quote(expr)}
|
||||
""".strip())
|
||||
dynix_append("services.distccd.maxJobs", new_jobs)
|
||||
do_apply()
|
||||
|
||||
args = get_cli_args()
|
||||
|
||||
|
|
@ -109,17 +121,8 @@ assert args.job_lifetime == 900, f'{args.job_lifetime} != 900'
|
|||
assert args.log_level == 'warning', f'{args.log_level=} != warning'
|
||||
|
||||
new_log_level = 'error'
|
||||
expr = textwrap.dedent(f"""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> {{ }};
|
||||
in nixos.config.dynamicism.doChange {{
|
||||
option = "services.distccd.logLevel";
|
||||
value = "{new_log_level}";
|
||||
}}
|
||||
""").strip()
|
||||
machine.succeed(rf"""
|
||||
nix run --show-trace --log-format raw-with-logs --impure -E {shlex.quote(expr)}
|
||||
""".strip())
|
||||
dynix_append("services.distccd.logLevel", f'"{new_log_level}"')
|
||||
do_apply()
|
||||
|
||||
args = get_cli_args()
|
||||
#assert args.jobs == new_jobs, f'{args.jobs=} != {new_jobs=}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue