2022-11-26 02:55:12 +01:00
|
|
|
{ zentralwerk, config, lib, ... }:
|
2022-11-02 23:37:01 +01:00
|
|
|
# our custom options
|
|
|
|
{
|
|
|
|
options.deployment = with lib; {
|
|
|
|
vcpu = mkOption {
|
|
|
|
type = types.int;
|
2022-11-24 00:03:30 +01:00
|
|
|
default = 4;
|
2022-11-02 23:37:01 +01:00
|
|
|
};
|
|
|
|
mem = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 512;
|
|
|
|
};
|
2022-12-04 21:32:16 +01:00
|
|
|
hypervisor = mkOption {
|
|
|
|
type = types.enum [
|
|
|
|
"qemu"
|
|
|
|
"cloud-hypervisor"
|
|
|
|
"firecracker"
|
|
|
|
"crosvm"
|
|
|
|
"kvmtool"
|
|
|
|
];
|
|
|
|
default = "cloud-hypervisor";
|
|
|
|
};
|
2022-11-07 21:15:37 +01:00
|
|
|
networks = mkOption {
|
|
|
|
type = with types; listOf str;
|
2022-11-26 01:41:28 +01:00
|
|
|
default = builtins.attrNames (
|
2022-12-04 08:53:28 +01:00
|
|
|
lib.filterAttrs (_: { hosts4, hosts6, ... }:
|
2022-11-26 02:53:32 +01:00
|
|
|
hosts4 ? ${config.networking.hostName} ||
|
2022-12-04 08:53:28 +01:00
|
|
|
lib.filterAttrs (_: hosts6:
|
2022-11-26 02:53:32 +01:00
|
|
|
hosts6 ? ${config.networking.hostName}
|
2022-11-26 01:41:28 +01:00
|
|
|
) hosts6 != {}
|
|
|
|
) zentralwerk.lib.config.site.net
|
|
|
|
);
|
2022-11-07 21:15:37 +01:00
|
|
|
};
|
2022-11-02 23:37:01 +01:00
|
|
|
persistedShares = mkOption {
|
|
|
|
type = with types; listOf str;
|
|
|
|
default = [ "/etc" "/home" "/var" ];
|
|
|
|
};
|
2022-11-25 23:04:27 +01:00
|
|
|
storage = mkOption {
|
|
|
|
type = types.enum [ "fast" "big" ];
|
|
|
|
default = "fast";
|
2022-11-26 00:34:41 +01:00
|
|
|
description = ''
|
2023-01-13 01:35:20 +01:00
|
|
|
Unused for now
|
2022-11-26 00:34:41 +01:00
|
|
|
'';
|
|
|
|
};
|
2022-12-12 21:16:20 +01:00
|
|
|
extraShares = mkOption {
|
|
|
|
type = with types; listOf (submodule {
|
|
|
|
options = {
|
|
|
|
source = mkOption {
|
|
|
|
type = str;
|
|
|
|
};
|
|
|
|
mountPoint = mkOption {
|
|
|
|
type = str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Extra shares. THESE MUST BE AVAILABLE ON ALL MICROVM HOSTS!
|
|
|
|
'';
|
|
|
|
};
|
2022-11-26 00:34:41 +01:00
|
|
|
needForSpeed = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Prefer deployment on Nomad clients with a higher c3d2.cpuSpeed
|
|
|
|
'';
|
2022-11-25 23:04:27 +01:00
|
|
|
};
|
2022-11-02 23:37:01 +01:00
|
|
|
};
|
2022-11-26 02:41:51 +01:00
|
|
|
|
|
|
|
config = {
|
|
|
|
# HACK: Avoid conflicts when building a NixOS configuration on Hydra
|
|
|
|
boot.loader.grub.enable = false;
|
2022-11-27 01:38:19 +01:00
|
|
|
fileSystems."/" = lib.mkDefault {
|
2022-11-26 02:41:51 +01:00
|
|
|
device = "rootfs";
|
|
|
|
fsType = "tmpfs";
|
2022-11-27 01:38:19 +01:00
|
|
|
options = [ "size=50%,mode=0755" ];
|
2022-11-26 02:41:51 +01:00
|
|
|
};
|
|
|
|
};
|
2022-11-02 23:37:01 +01:00
|
|
|
}
|