2024-02-28 23:28:38 +00:00
|
|
|
{ lib, ... }:
|
|
|
|
let
|
2024-02-29 19:51:52 +00:00
|
|
|
machineOpts = { config, ... }: {
|
2024-02-28 23:28:38 +00:00
|
|
|
options = {
|
2024-02-29 19:13:28 +00:00
|
|
|
kind = lib.mkOption {
|
2024-02-28 23:28:38 +00:00
|
|
|
type = lib.types.enum [ "physical" "virtual" ];
|
|
|
|
description = ''
|
|
|
|
Whether this machine is physical or virtual.
|
|
|
|
'';
|
2024-02-26 22:08:12 +00:00
|
|
|
};
|
|
|
|
|
2024-02-28 23:28:38 +00:00
|
|
|
hypervisorName = lib.mkOption {
|
|
|
|
default = null;
|
|
|
|
type = with lib.types; nullOr str;
|
|
|
|
description = ''
|
|
|
|
The host name of the hypervisor hosting this virtual machine.
|
|
|
|
'';
|
2024-01-31 21:11:28 +00:00
|
|
|
};
|
|
|
|
|
2024-02-28 23:28:38 +00:00
|
|
|
arch = lib.mkOption {
|
|
|
|
default = null;
|
|
|
|
type = with lib.types; nullOr str;
|
|
|
|
description = ''
|
|
|
|
CPU architecture of this machine.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
isRaspberryPi = lib.mkOption {
|
|
|
|
default = false;
|
|
|
|
type = lib.types.bool;
|
2024-01-31 21:11:28 +00:00
|
|
|
};
|
|
|
|
|
2024-02-28 23:28:38 +00:00
|
|
|
isHypervisor = lib.mkOption {
|
|
|
|
default = false;
|
|
|
|
type = lib.types.bool;
|
2024-02-27 22:28:52 +00:00
|
|
|
};
|
2024-01-28 11:55:58 +00:00
|
|
|
|
2024-02-29 19:51:52 +00:00
|
|
|
# Derived value
|
|
|
|
isPhysical = lib.mkOption {
|
|
|
|
default = config.kind == "physical";
|
|
|
|
type = lib.types.bool;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Derived value
|
|
|
|
isVirtual = lib.mkOption {
|
|
|
|
default = config.kind == "virtual";
|
|
|
|
type = lib.types.bool;
|
|
|
|
};
|
|
|
|
|
2024-02-28 23:28:38 +00:00
|
|
|
nixosModule = lib.mkOption {
|
|
|
|
default = { ... }: { };
|
|
|
|
type = lib.types.anything;
|
|
|
|
description = ''
|
|
|
|
Customized configuration for this machine in the form of a NixOS module.
|
|
|
|
'';
|
2023-11-25 20:00:21 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-02-28 23:28:38 +00:00
|
|
|
in
|
|
|
|
{
|
2024-02-29 19:30:32 +00:00
|
|
|
imports = [
|
|
|
|
./warwick.nix
|
|
|
|
./atlas.nix
|
|
|
|
./jefke.nix
|
|
|
|
./lewis.nix
|
|
|
|
./hermes.nix
|
|
|
|
./maestro.nix
|
|
|
|
./vpay.nix
|
|
|
|
];
|
|
|
|
|
2024-02-28 23:28:38 +00:00
|
|
|
options = {
|
|
|
|
machines = lib.mkOption {
|
|
|
|
type = with lib.types; attrsOf (submodule machineOpts);
|
|
|
|
};
|
|
|
|
};
|
2023-11-15 12:06:59 +00:00
|
|
|
}
|