Compare commits

...

2 commits

Author SHA1 Message Date
Max
ab654298ff checks/cluster: init WIP 2024-07-16 23:09:18 +02:00
Max
3cd4b78afe checks: add a bunch of snakeoil keys 2024-07-16 23:08:58 +02:00
14 changed files with 95 additions and 1 deletions

View file

@ -0,0 +1,71 @@
{ testers, config, extendModules, lib, system }:
let
lift = config;
snakeoil = {
ssh = {
public = lib.fileContents ./snakeoil/ssh/snakeoil-key.pub;
private = ./snakeoil/ssh/snakeoil-key;
};
wireguard = {
public = lib.genAttrs nodes (node: lib.fileContents ./snakeoil/wireguard/public-key-${toString digits.${node}});
private = lib.genAttrs nodes (node: ./snakeoil/wireguard/private-key-${toString digits.${node}});
};
};
nodes = lib.attrNames config.gods.fromLight;
digits = lib.attrsets.listToAttrs (lib.zipListsWith lib.nameValuePair nodes (lib.range 1 255));
depot' = extendModules {
modules = [
({ config, ... }: {
gods.fromLight = lib.mapAttrs (name: cfg: {
interfaces.primary = {
link = lib.mkForce "eth1";
addr = lib.mkForce "192.168.1.${toString digits.${name}}";
addrPublic = lib.mkForce "192.168.1.${toString digits.${name}}";
};
ssh.id.publicKey = lib.mkForce snakeoil.ssh.public;
}) lift.gods.fromLight;
cluster = lib.mkForce (lift.cluster.extendModules {
specialArgs.depot = config;
modules = [
{
hostLinks = lib.genAttrs nodes (node: {
mesh.extra = lib.mkForce (lift.cluster.config.hostLinks.${node}.mesh.extra // {
pubKey = snakeoil.wireguard.public.${node};
});
});
}
];
});
})
];
};
specialArgs = depot'.config.lib.summon system lib.id;
in
testers.runNixOSTest {
name = "cluster";
node = { inherit specialArgs; };
nodes = lib.genAttrs nodes (node: {
imports = [
specialArgs.depot.hours.${node}.nixos
./modules/nixos/age-dummy-secrets
] ++ depot'.config.cluster.config.out.injectNixosConfig node;
environment.etc."ssh/ssh_host_ed25519_key" = {
source = snakeoil.ssh.private;
mode = "0400";
};
environment.etc."dummy-secrets/cluster-wireguard-meshPrivateKey".source = lib.mkForce snakeoil.wireguard.private.${node};
passthru.depot = depot';
virtualisation.memorySize = 4096;
});
testScript = ''
grail.succeed("false")
'';
}

View file

@ -1,4 +1,4 @@
{ config, lib, self, ... }: { config, lib, self, extendModules, ... }:
let let
timeMachine = { timeMachine = {
@ -7,6 +7,7 @@ let
in in
{ {
debug = lib.warn "debug mode is enabled" true;
perSystem = { filters, pkgs, self', system, ... }: { perSystem = { filters, pkgs, self', system, ... }: {
checks = lib.mkIf (system == "x86_64-linux") { checks = lib.mkIf (system == "x86_64-linux") {
ascensions = pkgs.callPackage ./ascensions.nix { ascensions = pkgs.callPackage ./ascensions.nix {
@ -14,6 +15,10 @@ in
inherit (self) nixosModules; inherit (self) nixosModules;
}; };
cluster = pkgs.callPackage ./cluster.nix {
inherit config extendModules;
};
garage = pkgs.callPackage ./garage.nix { garage = pkgs.callPackage ./garage.nix {
inherit (self'.packages) garage consul; inherit (self'.packages) garage consul;
inherit (self) nixosModules; inherit (self) nixosModules;

View file

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACAOx03X+LtW0aN8ejdN4IJgDPrTZgVwe7WbXhhBvqVwgwAAAJAS78fWEu/H
1gAAAAtzc2gtZWQyNTUxOQAAACAOx03X+LtW0aN8ejdN4IJgDPrTZgVwe7WbXhhBvqVwgw
AAAEAUtGOZZIZdzGP6g85JuXBjDtciNQ9bLHNxSN5Gbwvb2Q7HTdf4u1bRo3x6N03ggmAM
+tNmBXB7tZteGEG+pXCDAAAACW1heEBUSVRBTgECAwQ=
-----END OPENSSH PRIVATE KEY-----

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA7HTdf4u1bRo3x6N03ggmAM+tNmBXB7tZteGEG+pXCD

View file

@ -0,0 +1 @@
YHzP8rBP6qiXs6ZdnvHop9KnCYRADIEejwZzAzvj8m4=

View file

@ -0,0 +1 @@
uD7X5E6N9d0sN+xPr/bWnehSa3bAok741GO7Z4I+Z3I=

View file

@ -0,0 +1 @@
YLl+hkWaCWx/5PpWs3cQ+bKqYdJef/qZ+FMTsM9ammM=

View file

@ -0,0 +1 @@
MNvWpMluuzQvPyGTp7jtyPSyz6n9lIly/WX1gW2NAHg=

View file

@ -0,0 +1 @@
QHyIJ3HoKGGFN28qOrQP4UyoQMP5bM7Idn2MzayKzEM=

View file

@ -0,0 +1 @@
TESTtbFybW5YREwtd18a1A4StS4YAIUS5/M1Lv0jHjA=

View file

@ -0,0 +1 @@
TEsTh7bthkaDh9A1CpqDi/F121ao5lRZqIJznLH8mB4=

View file

@ -0,0 +1 @@
tEST6afFmVN18o+EiWNFx+ax3MJwdQIeNfJSGEpffXw=

View file

@ -0,0 +1 @@
tEsT6s7VtM5C20eJBaq6UlQydAha8ATlmrTRe9T5jnM=

View file

@ -0,0 +1 @@
TEstYyb5IoqSL53HbSQwMhTaR16sxcWcMmXIBPd+1gE=