2024-03-17 18:48:49 +00:00
|
|
|
# An example nixos module declaring an interface.
|
|
|
|
{ lib, ... }:
|
|
|
|
{
|
2023-08-02 18:04:16 +00:00
|
|
|
options = {
|
2023-09-02 17:15:29 +00:00
|
|
|
# str
|
2023-08-02 18:04:16 +00:00
|
|
|
name = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "John Doe";
|
|
|
|
description = "The name of the user";
|
|
|
|
};
|
2023-09-02 17:15:29 +00:00
|
|
|
# int
|
2023-08-02 18:04:16 +00:00
|
|
|
age = lib.mkOption {
|
|
|
|
type = lib.types.int;
|
|
|
|
default = 42;
|
|
|
|
description = "The age of the user";
|
|
|
|
};
|
2023-09-02 17:15:29 +00:00
|
|
|
# bool
|
2023-08-02 18:04:16 +00:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-09-02 17:15:29 +00:00
|
|
|
# attrs of int
|
2023-08-02 18:04:16 +00:00
|
|
|
userIds = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf lib.types.int;
|
|
|
|
description = "Some attributes";
|
|
|
|
default = {
|
|
|
|
horst = 1;
|
|
|
|
peter = 2;
|
|
|
|
albrecht = 3;
|
|
|
|
};
|
|
|
|
};
|
2023-09-02 17:15:29 +00:00
|
|
|
# list of str
|
2023-08-02 18:04:16 +00:00
|
|
|
kernelModules = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2024-03-17 18:48:49 +00:00
|
|
|
default = [
|
|
|
|
"nvme"
|
|
|
|
"xhci_pci"
|
|
|
|
"ahci"
|
|
|
|
];
|
2023-08-02 18:04:16 +00:00
|
|
|
description = "A list of enabled kernel modules";
|
|
|
|
};
|
2024-05-03 16:22:20 +00:00
|
|
|
destinations = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf (
|
|
|
|
lib.types.submodule (
|
|
|
|
{ name, ... }:
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
name = lib.mkOption {
|
|
|
|
type = lib.types.strMatching "^[a-zA-Z0-9._-]+$";
|
|
|
|
default = name;
|
|
|
|
description = "the name of the backup job";
|
|
|
|
};
|
|
|
|
repo = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "the borgbackup repository to backup to";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
default = { };
|
|
|
|
};
|
2023-08-02 18:04:16 +00:00
|
|
|
};
|
|
|
|
}
|