From c431a60b34ef0acdf0f63d9a1a288dc17c0428d3 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 18 May 2026 14:09:55 +0200 Subject: [PATCH] flake + lib + module: drop unused makeTest/eval-config/qemu-common arg threading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the makeDiskoTest rewrite (commit 4) and the tests/ modulification (commit 5), the `makeTest`, `eval-config`, and `qemu-common` args threaded through flake.nix -> diskoLib = import ./lib { … } -> import ./tests { … } lib/default.nix -> testLib = import ./tests.nix { … } module.nix -> _module.args.diskoLib = import ./lib { … } are dead — every callsite now imports `nixos/lib/eval-config.nix` and `nixos/lib/qemu-common.nix` directly from `pkgs.path` (see `lib/tests.nix`, `lib/install-test.nix`, `tests/default.nix`). `makeTest` is replaced by the `nixos-lib.evalTest` call in `module.nix`'s `installTestEval` block. Strip the dead threading: - `flake.nix`: drop the three args from the `diskoLib = import ./lib` call and the `import ./tests` call. - `lib/default.nix`: drop them from the function signature and from the `testLib = import ./tests.nix { … }` call; drop the `qemu-common-lib` derivation that wrapped `qemu-common`. - `lib/tests.nix`: drop them from the function signature. - `module.nix`: drop them from the inner `_module.args.diskoLib = import ./lib { … }` call; drop the now-unused `modulesPath` arg destructure (its only consumers were the three `import "${modulesPath}/..."` lines just removed). --- flake.nix | 12 +----------- lib/default.nix | 20 +------------------- lib/tests.nix | 8 +------- module.nix | 4 ---- 4 files changed, 3 insertions(+), 41 deletions(-) diff --git a/flake.nix b/flake.nix index 9ba57c3..1bc96ff 100644 --- a/flake.nix +++ b/flake.nix @@ -24,9 +24,6 @@ diskoLib = import ./lib { inherit (nixpkgs) lib; - makeTest = import (nixpkgs + "/nixos/tests/make-test-python.nix"); - eval-config = import (nixpkgs + "/nixos/lib/eval-config.nix"); - qemu-common = import (nixpkgs + "/nixos/lib/qemu-common.nix"); }; in { @@ -62,14 +59,7 @@ let pkgs = nixpkgs.legacyPackages.${system}; # FIXME: aarch64-linux seems to hang on boot - nixosTests = lib.optionalAttrs pkgs.stdenv.hostPlatform.isx86_64 ( - import ./tests { - inherit pkgs; - makeTest = import (nixpkgs + "/nixos/tests/make-test-python.nix"); - eval-config = import (nixpkgs + "/nixos/lib/eval-config.nix"); - qemu-common = import (nixpkgs + "/nixos/lib/qemu-common.nix"); - } - ); + nixosTests = lib.optionalAttrs pkgs.stdenv.hostPlatform.isx86_64 (import ./tests { inherit pkgs; }); disko-install = pkgs.callPackage ./tests/disko-install { inherit self; diff --git a/lib/default.nix b/lib/default.nix index 39ccf84..6e86f57 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,29 +1,11 @@ { lib ? import , rootMountPoint ? "/mnt", - makeTest ? import , - eval-config ? import , - qemu-common ? import , }: let - # qemu-common is a function that takes { lib, stdenv } and returns QEMU utilities - qemu-common-lib = - pkgs: - qemu-common { - inherit lib; - inherit (pkgs) stdenv; - }; - outputs = import ../default.nix { inherit lib diskoLib; }; diskoLib = { - testLib = import ./tests.nix { - inherit - lib - makeTest - eval-config - qemu-common-lib - ; - }; + testLib = import ./tests.nix { inherit lib; }; # like lib.types.oneOf but instead of a list takes an attrset # uses the field "type" to find the correct type in the attrset subType = diff --git a/lib/tests.nix b/lib/tests.nix index c293c8f..bd6d8f6 100644 --- a/lib/tests.nix +++ b/lib/tests.nix @@ -1,10 +1,4 @@ -{ - lib, - makeTest, - eval-config, - qemu-common-lib, - ... -}: +{ lib, ... }: let testLib = { diff --git a/module.nix b/module.nix index 56f02b4..6271401 100644 --- a/module.nix +++ b/module.nix @@ -4,7 +4,6 @@ pkgs, extendModules, diskoLib, - modulesPath, ... }: let @@ -282,9 +281,6 @@ in _module.args.diskoLib = import ./lib { inherit lib; rootMountPoint = config.disko.rootMountPoint; - makeTest = import "${modulesPath}/../tests/make-test-python.nix"; - eval-config = import "${modulesPath}/../lib/eval-config.nix"; - qemu-common = import "${modulesPath}/../lib/qemu-common.nix"; }; system.build =