-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define NixOS tests in
tests/nixos/default.nix
rather than flake.nix
I think the our `flake.nix` is currently too large and too scary looking. I think this matters --- if Nix cannot dog-food itself in a way that is elegant, why should other people have confidence that their own code can be elegant and easy to maintain? We could do this at many points in time, but I think around now, when we are thinking about stabilizing parts of Flakes, is an especially good time. This is a first step to make the `flake.nix` smaller, and make individual components responsible for their own packaging. I hope we can do this many more follow-ups like it, until the top-level `flake.nix` is very small and just coordinates between other things.
- Loading branch information
1 parent
61720d0
commit 644ebaa
Showing
2 changed files
with
62 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |