mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-06 18:08:38 +08:00
Refactor tests to load flake inputs with flake-compat
This makes `nix fmt` just works and we no longer have to override flake inputs.
This commit is contained in:
70
tests/nixos-tests.nix
Normal file
70
tests/nixos-tests.nix
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
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
|
||||
Reference in New Issue
Block a user