From 6931853de3970726274e7e1351e0775e3e8218f9 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Wed, 18 Feb 2026 14:01:39 +0100 Subject: [PATCH] remove unused code --- default.nix | 2 +- modules/dynamicism/dynamicism.nix | 1 - tests/default.nix | 2 +- tests/distccd/test-script.py | 16 ++--- tests/gotosocial/configuration-package.nix | 7 --- tests/gotosocial/default.nix | 7 --- tests/gotosocial/hardware-configuration.nix | 7 --- tests/gotosocial/test-script.py | 7 +-- tests/harmonia/hardware-configuration.nix | 4 -- tests/harmonia/test-script.py | 7 +-- tests/tzupdate/configuration.nix | 67 --------------------- tests/tzupdate/hardware-configuration.nix | 4 -- tests/tzupdate/test-script.py | 52 ---------------- tests/tzupdate/test.nix | 24 -------- 14 files changed, 9 insertions(+), 198 deletions(-) delete mode 100644 tests/gotosocial/configuration-package.nix delete mode 100644 tests/gotosocial/default.nix delete mode 100644 tests/gotosocial/hardware-configuration.nix delete mode 100644 tests/harmonia/hardware-configuration.nix delete mode 100644 tests/tzupdate/configuration.nix delete mode 100644 tests/tzupdate/hardware-configuration.nix delete mode 100644 tests/tzupdate/test-script.py delete mode 100644 tests/tzupdate/test.nix diff --git a/default.nix b/default.nix index 2375445..64072a2 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,7 @@ { pkgs ? import { }, qpkgs ? let - src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages"); + src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz"; in import src { inherit pkgs; }, }: let inherit (qpkgs) lib; diff --git a/modules/dynamicism/dynamicism.nix b/modules/dynamicism/dynamicism.nix index 6f79993..75f9fcb 100644 --- a/modules/dynamicism/dynamicism.nix +++ b/modules/dynamicism/dynamicism.nix @@ -11,7 +11,6 @@ let inherit (import ./lib.nix { inherit lib; }) typeCheck - convenientAttrPath executablePathInStore concatFoldl recUpdateFoldl diff --git a/tests/default.nix b/tests/default.nix index 535c54b..02842fa 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,7 +1,7 @@ { pkgs ? import { }, qpkgs ? let - src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages"); + src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz"; in import src { inherit pkgs; }, callPackage ? qpkgs.callPackage, lib ? qpkgs.lib, diff --git a/tests/distccd/test-script.py b/tests/distccd/test-script.py index d5867bf..3a9da08 100644 --- a/tests/distccd/test-script.py +++ b/tests/distccd/test-script.py @@ -1,7 +1,5 @@ import argparse import functools -#from pathlib import Path -#from pprint import pformat import shlex import textwrap from typing import Any, cast, TYPE_CHECKING @@ -64,7 +62,6 @@ def get_cli_args() -> argparse.Namespace: machine.log(f"{cmdline_args=}") print(f"{cmdline_args=}") - #return shlex.join(cmdline_args[1:]) args, rest = parser.parse_known_args(cmdline_args) return args @@ -77,12 +74,7 @@ def dynix_append(option: str, value: Any): @beartype def do_apply(): expr = textwrap.dedent(""" - let - nixos = import { }; - in nixos.config.dynamicism.applyDynamicConfiguration { - baseConfiguration = /etc/nixos/configuration.nix; - newConfiguration = /etc/nixos/dynamic.nix; - } + (import { }).config.dynamicism.applyDynamicConfiguration { } """).strip() machine.succeed(rf""" @@ -95,7 +87,6 @@ machine.log("INIT") # Config should have our initial values. args = get_cli_args() -#assert '--jobs 12' in args, f'--jobs 12 not in {args=}' assert args.jobs == 12, f'{args.jobs=} != 12' assert args.job_lifetime == 900, f'{args.job_lifetime} != 900' assert args.log_level == 'warning', f'{args.log_level=} != warning' @@ -105,10 +96,13 @@ with machine.nested("must succeed: initial nixos-rebuild switch"): # Config should not have changed. args = get_cli_args() +assert args.jobs == 12, f'{args.jobs=} != 12' +assert args.job_lifetime == 900, f'{args.job_lifetime} != 900' +assert args.log_level == 'warning', f'{args.log_level=} != warning' #machine.log(f"config.toml after first rebuild: {indent(pformat(args))}") #assert int(args['workers']) == 4, f"{args['workers']=} != 4" #assert int(args['max_connection_rate']) == 256, f"{args['max_connection_rate']=} != 256" -# + new_jobs = 4 dynix_append("services.distccd.maxJobs", new_jobs) do_apply() diff --git a/tests/gotosocial/configuration-package.nix b/tests/gotosocial/configuration-package.nix deleted file mode 100644 index 96a89d8..0000000 --- a/tests/gotosocial/configuration-package.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - runCommand, -}: runCommand "tests-gotosocial-configuration-dot-nix" { -} '' - set -euo pipefail - install -Dm a=r ${./configuration.nix} "$out/share/nixos/configuration.nix" -'' diff --git a/tests/gotosocial/default.nix b/tests/gotosocial/default.nix deleted file mode 100644 index 7396103..0000000 --- a/tests/gotosocial/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Convenience shortcut for running this test from the command-line. - * Normally this test is initialized from /tests/default.nix. - */ -{ - pkgs ? import { }, -}: pkgs.testers.runNixOSTest ./test.nix diff --git a/tests/gotosocial/hardware-configuration.nix b/tests/gotosocial/hardware-configuration.nix deleted file mode 100644 index f036a72..0000000 --- a/tests/gotosocial/hardware-configuration.nix +++ /dev/null @@ -1,7 +0,0 @@ -/** Dummy hardware configuration. - * Will be replaced with the real one in the test VM. - */ -{ ... }: -{ - -} diff --git a/tests/gotosocial/test-script.py b/tests/gotosocial/test-script.py index 9799dfb..c6b087b 100644 --- a/tests/gotosocial/test-script.py +++ b/tests/gotosocial/test-script.py @@ -61,12 +61,7 @@ def dynix_append(option: str, value: str): @beartype def do_apply(): expr = textwrap.dedent(""" - let - nixos = import { }; - in nixos.config.dynamicism.applyDynamicConfiguration { - baseConfiguration = /etc/nixos/configuration.nix; - newConfiguration = /etc/nixos/dynamic.nix; - } + (import { }).config.dynamicism.applyDynamicConfiguration { } """).strip() machine.succeed(rf""" diff --git a/tests/harmonia/hardware-configuration.nix b/tests/harmonia/hardware-configuration.nix deleted file mode 100644 index facb35d..0000000 --- a/tests/harmonia/hardware-configuration.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - -} diff --git a/tests/harmonia/test-script.py b/tests/harmonia/test-script.py index 215ea38..be60fe3 100644 --- a/tests/harmonia/test-script.py +++ b/tests/harmonia/test-script.py @@ -64,12 +64,7 @@ def dynix_append(option: str, value: Any): @beartype def do_apply(): expr = textwrap.dedent(""" - let - nixos = import { }; - in nixos.config.dynamicism.applyDynamicConfiguration { - baseConfiguration = /etc/nixos/configuration.nix; - newConfiguration = /etc/nixos/dynamic.nix; - } + (import { }).config.dynamicism.applyDynamicConfiguration { } """).strip() machine.succeed(rf""" diff --git a/tests/tzupdate/configuration.nix b/tests/tzupdate/configuration.nix deleted file mode 100644 index 176975c..0000000 --- a/tests/tzupdate/configuration.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ pkgs, lib, config, modulesPath, ... }: -let - name = config.networking.hostName; - moduleList = import "${modulesPath}/module-list.nix"; - - dynixFromSearchPath = let - res = builtins.tryEval ; - in lib.optional res.success res.value; -in -{ - imports = [ - "${modulesPath}/testing/test-instrumentation.nix" - ./hardware-configuration.nix - ] ++ lib.concatLists [ - moduleList - dynixFromSearchPath - ]; - - dynamicism.for.tzupdate.enable = true; - services.tzupdate = { - enable = true; - }; - - system.switch.enable = true; - documentation.enable = false; - - networking.hostName = "tzupdate-machine"; - - boot.loader.grub = { - enable = true; - device = "/dev/vda"; - forceInstall = true; - }; - - nix = { - package = pkgs.lixPackageSets.latest.lix; - nixPath = [ - "nixpkgs=${pkgs.path}" - "/nix/var/nix/profiles/per-user/root/profile/share/nixos/modules" - ]; - - settings = { - experimental-features = [ "nix-command" "pipe-operator" ]; - substituters = lib.mkForce [ ]; - hashed-mirrors = null; - connect-timeout = 1; - # For my debugging purposes. - show-trace = true; - }; - }; - - environment.pathsToLink = [ "/share" ]; - environment.extraOutputsToInstall = [ "modules" ]; - environment.variables = { - "NIXOS_CONFIG" = "/etc/nixos/configuration.nix"; - }; - - environment.shellAliases = { - ls = "eza --long --header --group --group-directories-first --classify --binary"; - }; - - environment.systemPackages = with pkgs; [ - eza - fd - ripgrep - ]; -} diff --git a/tests/tzupdate/hardware-configuration.nix b/tests/tzupdate/hardware-configuration.nix deleted file mode 100644 index facb35d..0000000 --- a/tests/tzupdate/hardware-configuration.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - -} diff --git a/tests/tzupdate/test-script.py b/tests/tzupdate/test-script.py deleted file mode 100644 index 53762a0..0000000 --- a/tests/tzupdate/test-script.py +++ /dev/null @@ -1,52 +0,0 @@ -#from pathlib import Path -#import shlex -#import textwrap -from typing import cast, TYPE_CHECKING - -from beartype import beartype - -from test_driver.machine import Machine -from test_driver.errors import RequestedAssertionFailed - -if TYPE_CHECKING: - global machine - machine = cast(Machine, ...) - assert machine.shell is not None - -ls = "eza -lah --color=always --group-directories-first" - -@beartype -def run_log(machine: Machine, *commands: str, timeout: int | None = 60) -> str: - output = "" - for command in commands: - with machine.nested(f"must succeed: {command}"): - (status, out) = machine.execute(f"{command} | tee /dev/stderr", timeout=timeout) - if status != 0: - machine.log(f"output: {out}") - raise RequestedAssertionFailed( - f"command `{command}` failed (exit code {status})", - ) - output += out - - return output - -machine.wait_for_unit("default.target") -assert "lix" in machine.succeed("nix --version").lower() -machine.log("INIT") - - -machine.succeed("nixos-generate-config") -machine.succeed("mkdir -vp /etc/nixos") -# Dereference is required since that configuration.nix is probably a symlink to the store. -machine.succeed("cp -rv --dereference /run/current-system/sw/share/nixos/configuration.nix /etc/nixos/") - -machine.succeed("env PAGER= nixos-rebuild switch --log-format raw-with-logs --fallback") - -@beartype -def get_interval() -> str: - prop = machine.get_unit_property("tzupdate.timer", "OnCalendar") - print(f"{prop=}") - - return prop - -get_interval() diff --git a/tests/tzupdate/test.nix b/tests/tzupdate/test.nix deleted file mode 100644 index 2d42c10..0000000 --- a/tests/tzupdate/test.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: - -{ - name = "nixos-test-dynamicism-tzupdate"; - - extraPythonPackages = p: [ - p.beartype - ]; - - nodes.machine = { name, pkgs, ... }: { - imports = [ ./configuration.nix ]; - - environment.systemPackages = let - configFileTree = pkgs.runCommand "${name}-configuration-dot-nix" { } '' - set -euo pipefail - install -Dm a=r ${./configuration.nix} "$out/share/nixos/configuration.nix" - ''; - in [ - configFileTree - ]; - }; - - testScript = builtins.readFile ./test-script.py; -}