add derived isPhysical and isVirtual values for machines
This commit is contained in:
parent
960d3f6075
commit
0fe9aef9f5
6 changed files with 20 additions and 9 deletions
|
@ -1,8 +1,7 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
machineOpts = { ... }: {
|
||||
machineOpts = { config, ... }: {
|
||||
options = {
|
||||
# TODO: rename to kind?
|
||||
kind = lib.mkOption {
|
||||
type = lib.types.enum [ "physical" "virtual" ];
|
||||
description = ''
|
||||
|
@ -36,6 +35,18 @@ let
|
|||
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;
|
||||
|
|
Reference in a new issue