From 5fb2203af7b6c6d8106f740a4141cf89ae3d8344 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 1 Nov 2025 10:30:15 +0000 Subject: [PATCH] tests: move package to its own file Extract the `tests` package from `flake.nix` into its own file `tests/package.nix`. This a) de-couples it from the flake (to a degree) and b) allows more neatly using the callPackage pattern. --- flake.nix | 4 +--- tests/package.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 tests/package.nix diff --git a/flake.nix b/flake.nix index e4e4016f6..96e572f40 100644 --- a/flake.nix +++ b/flake.nix @@ -80,9 +80,7 @@ ./modules/misc/news/create-news-entry.sh ''; - tests = pkgs.writeShellScriptBin "tests" '' - exec ${pkgs.python3}/bin/python3 ${self}/tests/tests.py "$@" - ''; + tests = pkgs.callPackage ./tests/package.nix { flake = self; }; docs-html = docs.manual.html; docs-htmlOpenTool = docs.manual.htmlOpenTool; diff --git a/tests/package.nix b/tests/package.nix new file mode 100644 index 000000000..244a167f0 --- /dev/null +++ b/tests/package.nix @@ -0,0 +1,8 @@ +{ + flake, + python3, + writeShellScriptBin, +}: +writeShellScriptBin "tests" '' + exec ${python3}/bin/python3 ${flake}/tests/tests.py "$@" +''