diff options
Diffstat (limited to 'nixpkgs/nixos/tests/kernel-rust.nix')
-rw-r--r-- | nixpkgs/nixos/tests/kernel-rust.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/kernel-rust.nix b/nixpkgs/nixos/tests/kernel-rust.nix new file mode 100644 index 000000000000..1f269173ec2e --- /dev/null +++ b/nixpkgs/nixos/tests/kernel-rust.nix @@ -0,0 +1,43 @@ +{ system ? builtins.currentSystem +, config ? { } +, pkgs ? import ../.. { inherit system config; } +}: + +let + inherit (pkgs.lib) const filterAttrs mapAttrs; + + kernelRustTest = kernelPackages: import ./make-test-python.nix ({ lib, ... }: { + name = "kernel-rust"; + meta.maintainers = with lib.maintainers; [ blitz ma27 ]; + nodes.machine = { config, ... }: { + boot = { + inherit kernelPackages; + extraModulePackages = [ config.boot.kernelPackages.rust-out-of-tree-module ]; + kernelPatches = [ + { + name = "Rust Support"; + patch = null; + features = { + rust = true; + }; + } + ]; + }; + }; + testScript = '' + machine.wait_for_unit("default.target") + machine.succeed("modprobe rust_out_of_tree") + ''; + }); + + kernels = { + inherit (pkgs.linuxKernel.packages) linux_testing; + } + // filterAttrs + (const (x: let + inherit (builtins.tryEval ( + x.rust-out-of-tree-module or null != null + )) success value; + in success && value)) + pkgs.linuxKernel.vanillaPackages; +in mapAttrs (const kernelRustTest) kernels |