diff --git a/checks/flake-module.nix b/checks/flake-module.nix index 5c895c856..3a42db111 100644 --- a/checks/flake-module.nix +++ b/checks/flake-module.nix @@ -88,6 +88,7 @@ in nixos-test-container = self.clanLib.test.containerTest ./container nixosTestArgs; nixos-test-user-firewall-iptables = self.clanLib.test.containerTest ./user-firewall/iptables.nix nixosTestArgs; nixos-test-user-firewall-nftables = self.clanLib.test.containerTest ./user-firewall/nftables.nix nixosTestArgs; + nixos-test-extra-python-packages = self.clanLib.test.containerTest ./test-extra-python-packages nixosTestArgs; service-dummy-test = import ./service-dummy-test nixosTestArgs; wireguard = import ./wireguard nixosTestArgs; diff --git a/checks/test-extra-python-packages/default.nix b/checks/test-extra-python-packages/default.nix new file mode 100644 index 000000000..3dd5a26a0 --- /dev/null +++ b/checks/test-extra-python-packages/default.nix @@ -0,0 +1,26 @@ +( + { ... }: + { + name = "test-extra-python-packages"; + + extraPythonPackages = ps: [ ps.numpy ]; + + nodes.machine = + { ... }: + { + networking.hostName = "machine"; + }; + + testScript = '' + import numpy as np + + start_all() + machine.wait_for_unit("multi-user.target") + + # Test availability of numpy + arr = np.array([1, 2, 3]) + print(f"Numpy array: {arr}") + assert len(arr) == 3 + ''; + } +) diff --git a/lib/test/container-test-driver/driver-module.nix b/lib/test/container-test-driver/driver-module.nix index 51a1a4c70..aed764fd8 100644 --- a/lib/test/container-test-driver/driver-module.nix +++ b/lib/test/container-test-driver/driver-module.nix @@ -5,7 +5,7 @@ ... }: let - testDriver = hostPkgs.python3.pkgs.callPackage ./package.nix { + testDriver = hostPkgs.callPackage ./package.nix { inherit (config) extraPythonPackages; inherit (hostPkgs.pkgs) util-linux systemd nix; }; diff --git a/lib/test/container-test-driver/package.nix b/lib/test/container-test-driver/package.nix index ac9569281..963bd546e 100644 --- a/lib/test/container-test-driver/package.nix +++ b/lib/test/container-test-driver/package.nix @@ -2,28 +2,24 @@ extraPythonPackages ? (_ps: [ ]), python3Packages, python3, - buildPythonApplication, - setuptools, util-linux, systemd, nix, - colorama, - junit-xml, mkShell, }: let - package = buildPythonApplication { + package = python3Packages.buildPythonApplication { pname = "test-driver"; version = "0.0.1"; propagatedBuildInputs = [ util-linux systemd - colorama - junit-xml + python3Packages.colorama + python3Packages.junit-xml nix ] ++ extraPythonPackages python3Packages; - nativeBuildInputs = [ setuptools ]; + nativeBuildInputs = [ python3Packages.setuptools ]; format = "pyproject"; src = ./.; passthru.devShell = mkShell {