Files
nixos-hardware/tests/nixos-tests.nix
Jörg Thalheim 4bafcc2454 Refactor tests to load flake inputs with flake-compat
This makes `nix fmt` just works and we no longer have to override flake
inputs.
2025-10-30 12:36:49 +01:00

71 lines
1.5 KiB
Nix

{
self,
privateInputs,
system,
pkgs,
}:
let
# Hardware profile checks
blackList = [
# does import-from-derivation
"toshiba-swanky"
# uses custom nixpkgs config
"raspberry-pi-2"
# deprecated profiles
"framework"
"asus-zephyrus-ga402x"
"lenovo-yoga-7-14ARH7"
];
aarch64Systems = [
"raspberry-pi-3"
"raspberry-pi-4"
"raspberry-pi-5"
];
matchArch =
moduleName:
if builtins.elem moduleName aarch64Systems then
system == "aarch64-linux"
else
# TODO also add riscv64
system == "x86_64-linux";
modules = pkgs.lib.filterAttrs (
name: _: !(builtins.elem name blackList || pkgs.lib.hasPrefix "common-" name) && matchArch name
) self.nixosModules;
buildProfile = import ./build-profile.nix;
unfreeNixpkgs = {
config = {
allowBroken = true;
allowUnfree = true;
nvidia.acceptLicense = true;
};
overlays = [ ];
inherit system;
};
nixpkgsUnstable = import privateInputs.nixos-unstable-small unfreeNixpkgs;
nixpkgsStable = import privateInputs.nixos-stable unfreeNixpkgs;
# Build checks for both unstable and stable
unstableChecks = pkgs.lib.mapAttrs' (
name: module:
pkgs.lib.nameValuePair "unstable-${name}" (buildProfile {
pkgs = nixpkgsUnstable;
profile = module;
})
) modules;
stableChecks = pkgs.lib.mapAttrs' (
name: module:
pkgs.lib.nameValuePair "stable-${name}" (buildProfile {
pkgs = nixpkgsStable;
profile = module;
})
) modules;
in
unstableChecks // stableChecks