nix-config/modules/cluster/deployment-options.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
1.9 KiB
Nix
Raw Normal View History

{ zentralwerk, config, lib, ... }:
2022-11-02 23:37:01 +01:00
# our custom options
{
options.deployment = with lib; {
vcpu = mkOption {
type = types.int;
default = 4;
2022-11-02 23:37:01 +01:00
};
mem = mkOption {
type = types.int;
default = 512;
};
hypervisor = mkOption {
type = types.enum [
"qemu"
"cloud-hypervisor"
"firecracker"
"crosvm"
"kvmtool"
];
default = "cloud-hypervisor";
};
networks = mkOption {
type = with types; listOf str;
default = builtins.attrNames (
2022-12-04 08:53:28 +01:00
lib.filterAttrs (_: { hosts4, hosts6, ... }:
hosts4 ? ${config.networking.hostName} ||
2022-12-04 08:53:28 +01:00
lib.filterAttrs (_: hosts6:
hosts6 ? ${config.networking.hostName}
) hosts6 != {}
) zentralwerk.lib.config.site.net
);
};
2022-11-02 23:37:01 +01:00
persistedShares = mkOption {
type = with types; listOf str;
default = [ "/etc" "/home" "/var" ];
};
storage = mkOption {
type = types.enum [ "fast" "big" ];
default = "fast";
description = ''
Unused for now
'';
};
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!
'';
};
needForSpeed = mkOption {
type = types.bool;
default = false;
description = ''
Prefer deployment on Nomad clients with a higher c3d2.cpuSpeed
'';
};
2022-11-02 23:37:01 +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 {
device = "rootfs";
fsType = "tmpfs";
2022-11-27 01:38:19 +01:00
options = [ "size=50%,mode=0755" ];
};
};
2022-11-02 23:37:01 +01:00
}