245 lines
5.1 KiB
Nix
245 lines
5.1 KiB
Nix
{ lib, ... }:
|
|
let
|
|
emailProviderType = lib.types.enum [
|
|
"mxrouting"
|
|
"office365"
|
|
];
|
|
|
|
emailType = lib.types.submodule (
|
|
{ ... }:
|
|
{
|
|
options = {
|
|
address = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
primary = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
|
|
type = lib.mkOption {
|
|
type = emailProviderType;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
sshKeyType = lib.types.submodule (
|
|
{ name, ... }:
|
|
{
|
|
options = {
|
|
publicKey = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
privateKeyPath = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "~/.ssh/id_${name}";
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
accountType = lib.types.submodule (
|
|
{ config, ... }:
|
|
{
|
|
options = {
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
realName = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
homeDirectory = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/home/${config.name}";
|
|
};
|
|
|
|
nixosConfigurationPath = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "${config.homeDirectory}/.config/nixos";
|
|
};
|
|
|
|
emails = lib.mkOption {
|
|
type = lib.types.attrsOf emailType;
|
|
default = { };
|
|
};
|
|
|
|
primaryEmail = lib.mkOption {
|
|
type = lib.types.nullOr emailType;
|
|
description = "Derived primary email entry for this user.";
|
|
default =
|
|
let
|
|
emails = builtins.attrValues config.emails;
|
|
in
|
|
lib.findFirst (email: email.primary) null emails;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
desktopApplicationType = lib.types.submodule (
|
|
{ config, ... }:
|
|
{
|
|
options = {
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
};
|
|
|
|
command = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = lib.getExe config.package;
|
|
defaultText = lib.literalExpression "lib.getExe config.package";
|
|
};
|
|
|
|
desktopEntryName = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
desktopId = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "${config.desktopEntryName}.desktop";
|
|
defaultText = lib.literalExpression ''"${config.desktopEntryName}.desktop"'';
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
displayType = lib.types.submodule (
|
|
{ ... }:
|
|
{
|
|
options = {
|
|
primary = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
|
|
x = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 0;
|
|
};
|
|
|
|
y = lib.mkOption {
|
|
type = lib.types.int;
|
|
default = 0;
|
|
};
|
|
|
|
scale = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.float;
|
|
default = null;
|
|
};
|
|
|
|
width = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.int;
|
|
default = null;
|
|
};
|
|
|
|
height = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.int;
|
|
default = null;
|
|
};
|
|
|
|
refresh = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.float;
|
|
default = null;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
machineType = lib.types.submodule (
|
|
{ name, config, ... }:
|
|
{
|
|
options = {
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = name;
|
|
};
|
|
|
|
stateVersion = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
hmStateVersion = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = config.stateVersion;
|
|
};
|
|
|
|
displays = lib.mkOption {
|
|
type = lib.types.attrsOf displayType;
|
|
default = { };
|
|
};
|
|
|
|
sshKeys = lib.mkOption {
|
|
type = lib.types.attrsOf sshKeyType;
|
|
default = { };
|
|
};
|
|
|
|
syncthingId = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.str;
|
|
default = null;
|
|
};
|
|
|
|
portable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
in
|
|
{
|
|
options.repo = {
|
|
account = lib.mkOption {
|
|
type = accountType;
|
|
};
|
|
|
|
machines = lib.mkOption {
|
|
type = lib.types.attrsOf machineType;
|
|
default = { };
|
|
};
|
|
|
|
services = lib.mkOption {
|
|
type = lib.types.raw;
|
|
default = { };
|
|
};
|
|
|
|
theme = lib.mkOption {
|
|
type = lib.types.raw;
|
|
default = { };
|
|
};
|
|
};
|
|
|
|
config.flake.modules.nixos.meta =
|
|
{ ... }:
|
|
{
|
|
options.meta.machine = lib.mkOption {
|
|
type = machineType;
|
|
};
|
|
};
|
|
|
|
config.flake.modules.homeManager.meta =
|
|
{ ... }:
|
|
{
|
|
options.meta.desktop.browser = lib.mkOption {
|
|
type = desktopApplicationType;
|
|
};
|
|
|
|
options.meta.desktop.fileManager = lib.mkOption {
|
|
type = desktopApplicationType;
|
|
};
|
|
|
|
options.meta.desktop.terminal = lib.mkOption {
|
|
type = desktopApplicationType;
|
|
};
|
|
|
|
options.meta.pinentry.package = lib.mkOption {
|
|
type = lib.types.package;
|
|
};
|
|
};
|
|
|
|
}
|