mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
Asserting the hostplatform for `linux` is bad, because it can't be
caught by CI. For the `linux` package itself, it doesn't make a
difference, because it also has `meta.platforms = linux` set, so this
will fail evaluation - and in a way that can nicely be caught by CI.
(cherry picked from commit 0febbb4ff9)
35 lines
732 B
Nix
35 lines
732 B
Nix
/*
|
|
This file is a test that makes sure that the `pkgs.nixos` and
|
|
`pkgs.testers.nixosTest` functions work. It's far from a perfect test suite,
|
|
but better than not checking them at all on hydra.
|
|
|
|
To run this test:
|
|
|
|
nixpkgs$ nix-build -A tests.nixos-functions
|
|
*/
|
|
{
|
|
pkgs,
|
|
lib,
|
|
stdenv,
|
|
...
|
|
}:
|
|
|
|
let
|
|
dummyVersioning = {
|
|
revision = "test";
|
|
versionSuffix = "test";
|
|
label = "test";
|
|
};
|
|
in
|
|
lib.optionalAttrs (stdenv.hostPlatform.isLinux) (
|
|
pkgs.recurseIntoAttrs {
|
|
nixos-test =
|
|
(pkgs.nixos {
|
|
system.nixos = dummyVersioning;
|
|
boot.loader.grub.enable = false;
|
|
fileSystems."/".device = "/dev/null";
|
|
system.stateVersion = lib.trivial.release;
|
|
}).toplevel;
|
|
}
|
|
)
|