Skip to content

Commit

Permalink
Merge pull request #227 from ngi-nix/projects-interactive-conf
Browse files Browse the repository at this point in the history
projects: create a default interactive configuration for NixOS tests
  • Loading branch information
lorenzleutgeb committed May 14, 2024
2 parents d2a65d9 + e98ada4 commit 17c5cb6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 71 deletions.
27 changes: 0 additions & 27 deletions projects/Kbin/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,4 @@ in {
server.wait_for_unit("nginx.service")
server.succeed("curl --fail --connect-timeout 10 http://localhost/u/admin")
'';

# NOTE: Below configuration is for "interactive" (=developing/debugging) only.
interactive.nodes = let
tools = {pkgs, ...}: {
environment.systemPackages = with pkgs; [vim tmux jq];
};

# Use kmscon <https://www.freedesktop.org/wiki/Software/kmscon/>
# to provide a slightly nicer console, and while we're at it,
# also use a nice font.
# With kmscon, we can for example zoom in/out using [Ctrl] + [+]
# and [Ctrl] + [-]
niceConsoleAndAutologin = {pkgs, ...}: {
services.kmscon = {
enable = true;
autologinUser = "root";
fonts = [
{
name = "Fira Code";
package = pkgs.fira-code;
}
];
};
};
in {
server.imports = [niceConsoleAndAutologin tools];
};
}
22 changes: 0 additions & 22 deletions projects/Rosenpass/tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,4 @@ in {
for machine in [server, client]:
machine.wait_until_succeeds("wg show all preshared-keys | grep --invert-match none", timeout=5)
'';

# NOTE: Below configuration is for "interactive" (=developing/debugging) only.
interactive.nodes = let
# Use kmscon <https://www.freedesktop.org/wiki/Software/kmscon/>
# to provide a slightly nicer console, and while we're at it,
# also use a nice font.
# With kmscon, we can for example zoom in/out using [Ctrl] + [+]
# and [Ctrl] + [-]
niceConsoleAndAutologin.services.kmscon = {
enable = true;
autologinUser = "root";
fonts = [
{
name = "Fira Code";
package = pkgs.fira-code;
}
];
};
in {
server = niceConsoleAndAutologin;
client = niceConsoleAndAutologin;
};
}
21 changes: 0 additions & 21 deletions projects/Vula/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,4 @@
testScript = {nodes, ...}: ''
start_all()
'';

# NOTE: Below configuration is for "interactive" (=developing/debugging) only.
interactive.nodes = let
# Use kmscon <https://www.freedesktop.org/wiki/Software/kmscon/>
# to provide a slightly nicer console, and while we're at it,
# also use a nice font.
# With kmscon, we can for example zoom in/out using [Ctrl] + [+]
# and [Ctrl] + [-]
niceConsoleAndAutologin.services.kmscon = {
enable = true;
autologinUser = "root";
fonts = [
{
name = "Fira Code";
package = pkgs.fira-code;
}
];
};
in {
server = niceConsoleAndAutologin;
};
}
31 changes: 30 additions & 1 deletion projects/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,39 @@
then assert elem name allowedFiles; false
else true;

nixosTest = test: let
tools = {pkgs, ...}: {
environment.systemPackages = with pkgs; [vim tmux jq];
};

# Use kmscon <https://www.freedesktop.org/wiki/Software/kmscon/>
# to provide a slightly nicer console, and while we're at it,
# also use a nice font.
# With kmscon, we can for example zoom in/out using [Ctrl] + [+]
# and [Ctrl] + [-]
niceConsoleAndAutologin = {pkgs, ...}: {
services.kmscon = {
enable = true;
autologinUser = "root";
fonts = [
{
name = "Fira Code";
package = pkgs.fira-code;
}
];
};
};
in
pkgs.nixosTest ({
# NOTE: Below configuration is for "interactive" (=developing/debugging) only.
interactive.nodes = mapAttrs (_: _: {imports = [niceConsoleAndAutologin tools];}) test.nodes;
}
// test);

hydrate = project:
recursiveUpdate
project
{nixos.tests = mapAttrs (_: pkgs.nixosTest) project.nixos.tests or {};};
{nixos.tests = mapAttrs (_: nixosTest) project.nixos.tests or {};};
in
mapAttrs (
name: type: let
Expand Down

0 comments on commit 17c5cb6

Please sign in to comment.