Commit files for public release
All checks were successful
CI / build (push) Successful in 13m53s

This commit is contained in:
Fabian Hauser 2024-10-02 16:52:04 +03:00
commit fef2377502
174 changed files with 7423 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
options,
...
}:
with lib;
let
cfg = config.qois.meta.hosts;
in
{
options.qois.meta.hosts = mkOption {
type = types.attrsOf (
types.submodule (
{ name, ... }:
{
options = {
hostName = mkOption {
type = types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
default = name;
description = "The host's name. See networking.hostName for more details.";
};
sshKey = mkOption {
type = types.nullOr (types.strMatching "^ssh-ed25519 [a-zA-Z0-9/+]{68}$");
default = null;
example = "ssh-ed25519 AAAAbcdefgh....xyz root@myhost";
description = lib.mdDoc ''
The ssh public key of ed25519 type.
May be fetched with `ssh-keyscan example.com`.
'';
};
};
}
)
);
default = { };
description = "Host configuration properties options";
};
config =
let
hostsWithSshKey = lib.filterAttrs (name: hostCfg: hostCfg.sshKey != null) cfg;
in
{
programs.ssh.knownHosts = lib.mapAttrs (name: hostCfg: {
publicKey = hostCfg.sshKey;
}) hostsWithSshKey;
};
}