Refactor: move checks/lib into lib/ to avoid duplicate lib
Lets avoid the mistake of nixpkgs having multiple libs
This commit is contained in:
30
lib/test/container-test.nix
Normal file
30
lib/test/container-test.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
test:
|
||||
{ pkgs, self, ... }:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
nixos-lib = import (pkgs.path + "/nixos/lib") { };
|
||||
in
|
||||
(nixos-lib.runTest {
|
||||
hostPkgs = pkgs;
|
||||
# speed-up evaluation
|
||||
defaults =
|
||||
{ config, options, ... }:
|
||||
{
|
||||
imports = [
|
||||
self.clanLib.test.minifyModule
|
||||
];
|
||||
config = lib.optionalAttrs (options ? clan) {
|
||||
clan.core.settings.machine.name = config.networking.hostName;
|
||||
};
|
||||
};
|
||||
# TODO: Remove this. We should not pass special args in the test framework
|
||||
# Instead each test can forward the special args it needs
|
||||
# to accept external dependencies such as disko
|
||||
node.specialArgs.self = self;
|
||||
_module.args = { inherit self; };
|
||||
|
||||
imports = [
|
||||
test
|
||||
../../lib/test/container-test-driver/driver-module.nix
|
||||
];
|
||||
}).config.result
|
||||
@@ -7,9 +7,12 @@ let
|
||||
|
||||
in
|
||||
{
|
||||
#
|
||||
containerTest = import ./container-test.nix;
|
||||
baseTest = import ./test-base.nix;
|
||||
#
|
||||
flakeModules = clanLib.callLib ./flakeModules.nix { };
|
||||
|
||||
#
|
||||
minifyModule = ./minify.nix;
|
||||
sopsModule = ./sops.nix;
|
||||
# A function that returns an extension to runTest
|
||||
|
||||
33
lib/test/test-base.nix
Normal file
33
lib/test/test-base.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
test:
|
||||
{ pkgs, self, ... }:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
nixos-lib = import (pkgs.path + "/nixos/lib") { };
|
||||
in
|
||||
(nixos-lib.runTest {
|
||||
hostPkgs = pkgs;
|
||||
# speed-up evaluation
|
||||
defaults = (
|
||||
{ config, options, ... }:
|
||||
{
|
||||
imports = [
|
||||
self.clanLib.test.minifyModule
|
||||
];
|
||||
config = lib.mkMerge [
|
||||
(lib.optionalAttrs (options ? clan) {
|
||||
clan.core.settings.machine.name = config.networking.hostName;
|
||||
})
|
||||
{
|
||||
documentation.enable = lib.mkDefault false;
|
||||
nix.settings.min-free = 0;
|
||||
system.stateVersion = config.system.nixos.release;
|
||||
}
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
_module.args = { inherit self; };
|
||||
# to accept external dependencies such as disko
|
||||
node.specialArgs.self = self;
|
||||
imports = [ test ];
|
||||
}).config.result
|
||||
Reference in New Issue
Block a user