nixos-servers/nix/machines/default.nix

76 lines
1.6 KiB
Nix

{ lib, ... }:
let
machineOpts = { config, ... }: {
options = {
kind = lib.mkOption {
type = lib.types.enum [ "physical" "virtual" ];
description = ''
Whether this machine is physical or virtual.
'';
};
hypervisorName = lib.mkOption {
default = null;
type = with lib.types; nullOr str;
description = ''
The host name of the hypervisor hosting this virtual machine.
'';
};
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;
};
isHypervisor = lib.mkOption {
default = false;
type = lib.types.bool;
};
# 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;
};
nixosModule = lib.mkOption {
default = { ... }: { };
type = lib.types.anything;
description = ''
Customized configuration for this machine in the form of a NixOS module.
'';
};
};
};
in
{
imports = [
./warwick.nix
./atlas.nix
./jefke.nix
./lewis.nix
./hermes.nix
./maestro.nix
./vpay.nix
];
options = {
machines = lib.mkOption {
type = with lib.types; attrsOf (submodule machineOpts);
};
};
}