Skip to content

Commit 9911f41

Browse files
committed
wip
1 parent 785c742 commit 9911f41

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

checks/vm-tests.nix

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@
1010
inputs',
1111
self',
1212
pkgs,
13+
system,
1314
...
1415
}:
1516
{
1617
checks = {
1718
"healthcheck-test-01" = pkgs.testers.runNixOSTest {
1819
name = "healthcheck-test-01";
19-
nodes = {
20-
machine =
21-
{ config, pkgs, ... }:
22-
{
23-
24-
imports = [
25-
self.modules.nixos.machine_healthcheck
26-
];
27-
28-
};
29-
testScript =
30-
{ nodes, ... }:
31-
''
32-
machine.wait_for_unit("default.target")
33-
'';
20+
node.specialArgs = {
21+
inherit self system lib;
3422
};
23+
testScript = ''
24+
machine.start()
25+
machine.wait_for_unit("default.target")
26+
'';
27+
nodes.machine =
28+
{ pkgs, ... }:
29+
{
30+
imports = [
31+
../machines/modules/base.nix
32+
../machines/modules/healthcheck.nix
33+
];
34+
};
35+
3536
};
3637
};
3738
};

machines/default.nix

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@
55
}:
66
let
77
system = "x86_64-linux";
8+
pkgs = import self.inputs.nixpkgs {
9+
inherit system;
10+
config.allowUnfree = true;
11+
};
812
mkMachine = x: {
913
"${lib.removeSuffix ".nix" x}" = lib.nixosSystem {
1014
specialArgs = { inherit self system; };
1115
modules = lib.unique [
16+
{
17+
nixpkgs.system = system;
18+
}
1219
./modules/base.nix
1320
./modules/${x}
1421
];
@@ -22,7 +29,14 @@ in
2229
flake.modules.nixos = (
2330
lib.mergeAttrsList (
2431
lib.map (x: {
25-
"machine_${lib.removeSuffix ".nix" x}" = (import (./modules + "/${x}"));
32+
"machine_${lib.removeSuffix ".nix" x}" = (
33+
import (./modules + "/${x}") {
34+
inherit
35+
self
36+
pkgs
37+
;
38+
}
39+
);
2640
}) (builtins.attrNames (builtins.readDir ./modules))
2741
)
2842
);

machines/modules/base.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
{ system, lib, ... }:
1+
{ lib, ... }:
22
{
3-
nixpkgs.system = system;
43
fileSystems = {
54
"/".device = lib.mkDefault "/dev/sda";
65
};

machines/modules/healthcheck.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
systemd.services.test = {
88
description = "";
99
enable = true;
10-
path = with pkgs; [
10+
path = [
1111
];
1212
serviceConfig = {
1313
Type = "simple";

0 commit comments

Comments
 (0)