forked from lix-project/lix
Merge pull request #9105 from Ericson2314/split-out-nixos-tests
Define NixOS tests in `tests/nixos/default.nix` rather than `flake.nix` (cherry picked from commitc29b8ba142
) Change-Id:Ieae1b6476d95024485df7067e008013bc5542039
This commit is contained in:
parent
5bda6d9dc8
commit
2e1f5e2666
40
flake.nix
40
flake.nix
|
@ -512,18 +512,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-lib = import (nixpkgs + "/nixos/lib") { };
|
|
||||||
|
|
||||||
# https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests
|
|
||||||
runNixOSTestFor = system: test: nixos-lib.runTest {
|
|
||||||
imports = [ test ];
|
|
||||||
hostPkgs = nixpkgsFor.${system}.native;
|
|
||||||
defaults = {
|
|
||||||
nixpkgs.pkgs = nixpkgsFor.${system}.native;
|
|
||||||
};
|
|
||||||
_module.args.nixpkgs = nixpkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
# A Nixpkgs overlay that overrides the 'nix' and
|
# A Nixpkgs overlay that overrides the 'nix' and
|
||||||
# 'nix.perl-bindings' packages.
|
# 'nix.perl-bindings' packages.
|
||||||
|
@ -632,32 +620,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# System tests.
|
# System tests.
|
||||||
tests.authorization = runNixOSTestFor "x86_64-linux" ./tests/nixos/authorization.nix;
|
tests = import ./tests/nixos { inherit lib nixpkgs nixpkgsFor; } // {
|
||||||
|
|
||||||
tests.remoteBuilds = runNixOSTestFor "x86_64-linux" ./tests/nixos/remote-builds.nix;
|
|
||||||
|
|
||||||
tests.nix-copy-closure = runNixOSTestFor "x86_64-linux" ./tests/nixos/nix-copy-closure.nix;
|
|
||||||
|
|
||||||
tests.nix-copy = runNixOSTestFor "x86_64-linux" ./tests/nixos/nix-copy.nix;
|
|
||||||
|
|
||||||
tests.nssPreload = runNixOSTestFor "x86_64-linux" ./tests/nixos/nss-preload.nix;
|
|
||||||
|
|
||||||
tests.githubFlakes = runNixOSTestFor "x86_64-linux" ./tests/nixos/github-flakes.nix;
|
|
||||||
|
|
||||||
tests.sourcehutFlakes = runNixOSTestFor "x86_64-linux" ./tests/nixos/sourcehut-flakes.nix;
|
|
||||||
|
|
||||||
tests.tarballFlakes = runNixOSTestFor "x86_64-linux" ./tests/nixos/tarball-flakes.nix;
|
|
||||||
|
|
||||||
tests.containers = runNixOSTestFor "x86_64-linux" ./tests/nixos/containers/containers.nix;
|
|
||||||
|
|
||||||
tests.setuid = lib.genAttrs
|
|
||||||
["i686-linux" "x86_64-linux"]
|
|
||||||
(system: runNixOSTestFor system ./tests/nixos/setuid.nix);
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure that nix-env still produces the exact same result
|
# Make sure that nix-env still produces the exact same result
|
||||||
# on a particular version of Nixpkgs.
|
# on a particular version of Nixpkgs.
|
||||||
tests.evalNixpkgs =
|
evalNixpkgs =
|
||||||
with nixpkgsFor.x86_64-linux.native;
|
with nixpkgsFor.x86_64-linux.native;
|
||||||
runCommand "eval-nixos" { buildInputs = [ nix ]; }
|
runCommand "eval-nixos" { buildInputs = [ nix ]; }
|
||||||
''
|
''
|
||||||
|
@ -668,13 +635,14 @@
|
||||||
mkdir $out
|
mkdir $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
tests.nixpkgsLibTests =
|
nixpkgsLibTests =
|
||||||
forAllSystems (system:
|
forAllSystems (system:
|
||||||
import (nixpkgs + "/lib/tests/release.nix")
|
import (nixpkgs + "/lib/tests/release.nix")
|
||||||
{ pkgs = nixpkgsFor.${system}.native;
|
{ pkgs = nixpkgsFor.${system}.native;
|
||||||
nixVersions = [ self.packages.${system}.nix ];
|
nixVersions = [ self.packages.${system}.nix ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" {
|
metrics.nixpkgs = import "${nixpkgs-regression}/pkgs/top-level/metrics.nix" {
|
||||||
pkgs = nixpkgsFor.x86_64-linux.native;
|
pkgs = nixpkgsFor.x86_64-linux.native;
|
||||||
|
|
41
tests/nixos/default.nix
Normal file
41
tests/nixos/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ lib, nixpkgs, nixpkgsFor }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
nixos-lib = import (nixpkgs + "/nixos/lib") { };
|
||||||
|
|
||||||
|
# https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests
|
||||||
|
runNixOSTestFor = system: test: nixos-lib.runTest {
|
||||||
|
imports = [ test ];
|
||||||
|
hostPkgs = nixpkgsFor.${system}.native;
|
||||||
|
defaults = {
|
||||||
|
nixpkgs.pkgs = nixpkgsFor.${system}.native;
|
||||||
|
};
|
||||||
|
_module.args.nixpkgs = nixpkgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
authorization = runNixOSTestFor "x86_64-linux" ./authorization.nix;
|
||||||
|
|
||||||
|
remoteBuilds = runNixOSTestFor "x86_64-linux" ./remote-builds.nix;
|
||||||
|
|
||||||
|
nix-copy-closure = runNixOSTestFor "x86_64-linux" ./nix-copy-closure.nix;
|
||||||
|
|
||||||
|
nix-copy = runNixOSTestFor "x86_64-linux" ./nix-copy.nix;
|
||||||
|
|
||||||
|
nssPreload = runNixOSTestFor "x86_64-linux" ./nss-preload.nix;
|
||||||
|
|
||||||
|
githubFlakes = runNixOSTestFor "x86_64-linux" ./github-flakes.nix;
|
||||||
|
|
||||||
|
sourcehutFlakes = runNixOSTestFor "x86_64-linux" ./sourcehut-flakes.nix;
|
||||||
|
|
||||||
|
tarballFlakes = runNixOSTestFor "x86_64-linux" ./tarball-flakes.nix;
|
||||||
|
|
||||||
|
containers = runNixOSTestFor "x86_64-linux" ./containers/containers.nix;
|
||||||
|
|
||||||
|
setuid = lib.genAttrs
|
||||||
|
["i686-linux" "x86_64-linux"]
|
||||||
|
(system: runNixOSTestFor system ./setuid.nix);
|
||||||
|
}
|
Loading…
Reference in a new issue