52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
/*
|
|
An example nixos module declaring an interface.
|
|
*/
|
|
{ lib, ... }: {
|
|
options = {
|
|
# str
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "John Doe";
|
|
description = "The name of the user";
|
|
};
|
|
# int
|
|
age = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 42;
|
|
description = "The age of the user";
|
|
};
|
|
# bool
|
|
isAdmin = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Is the user an admin?";
|
|
};
|
|
# a submodule option
|
|
services = lib.mkOption {
|
|
type = lib.types.submodule {
|
|
options.opt = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "foo";
|
|
description = "A submodule option";
|
|
};
|
|
};
|
|
};
|
|
# attrs of int
|
|
userIds = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.int;
|
|
description = "Some attributes";
|
|
default = {
|
|
horst = 1;
|
|
peter = 2;
|
|
albrecht = 3;
|
|
};
|
|
};
|
|
# list of str
|
|
kernelModules = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ "nvme" "xhci_pci" "ahci" ];
|
|
description = "A list of enabled kernel modules";
|
|
};
|
|
};
|
|
}
|