156 lines
3.5 KiB
Nix
156 lines
3.5 KiB
Nix
{ inputs, lib, ... }:
|
|
let
|
|
userOpt = with lib; {
|
|
username = mkOption { type = types.str; };
|
|
wm = mkOption {
|
|
type = types.enum [ "Wayland" "X11" "-" ];
|
|
default = "-";
|
|
};
|
|
git = {
|
|
username = mkOption { type = types.str; };
|
|
email = mkOption { type = types.str; };
|
|
key = mkOption { type = types.str; };
|
|
};
|
|
};
|
|
netOpt = with lib; {
|
|
ble = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
wlp = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
nif = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
};
|
|
};
|
|
wg = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
ip4 = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
};
|
|
ip6 = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
};
|
|
server = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
peers = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [];
|
|
};
|
|
forward = {
|
|
inInterface = mkOption {
|
|
type = types.str;
|
|
default = "ens3";
|
|
description = "Incoming interface for forwarding";
|
|
};
|
|
|
|
toAddr = mkOption {
|
|
type = types.str;
|
|
description = "Destination address (IPv4 or IPv6)";
|
|
example = "10.10.1.2";
|
|
};
|
|
|
|
ports = mkOption {
|
|
type = types.listOf (types.listOf types.port);
|
|
default = [];
|
|
description = "Port mappings: [ [srcPort dstPort] ... ]";
|
|
example = [ [ 22 22 ] [ 80 80 ] [ 443 443 ] ];
|
|
};
|
|
}
|
|
};
|
|
};
|
|
};
|
|
makeOpt = with lib; {
|
|
cli = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
gui = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
virt = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
power = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
game = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
develop = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
serverOpt = with lib; {
|
|
hostDomain = mkOption { type = types.str; };
|
|
shortName = mkOption { type = types.str; };
|
|
mailDomain = mkOption { type = types.str; };
|
|
mailServer = mkOption { type = types.str; };
|
|
|
|
dbHost = mkOption {
|
|
type = types.str;
|
|
default = "localhost";
|
|
};
|
|
dbPort = mkOption {
|
|
type = types.str;
|
|
default = "3306";
|
|
};
|
|
|
|
configPath = mkOption {
|
|
type = types.str;
|
|
default = "/media/config";
|
|
};
|
|
dataPath = mkOption {
|
|
type = types.str;
|
|
default = "/media/data";
|
|
};
|
|
|
|
};
|
|
in with lib; {
|
|
options.usercfg = userOpt;
|
|
options.syscfg = {
|
|
hostname = mkOption { type = types.str; };
|
|
type = mkOption {
|
|
type = types.enum [ "nixos" "macos" "home" ];
|
|
default = "nixos";
|
|
};
|
|
system = mkOption {
|
|
type = types.enum [ "x86_64-linux" "x86_64-darwin" "-" ];
|
|
default = "x86_64-linux";
|
|
};
|
|
defaultUser = mkOption { type = types.str; };
|
|
make = makeOpt;
|
|
net = netOpt;
|
|
users = mkOption {
|
|
type = types.listOf (types.submodule { options = userOpt; });
|
|
default = [ ];
|
|
};
|
|
server = mkOption {
|
|
type = types.oneOf [
|
|
(types.attrs)
|
|
(types.submodule { options = serverOpt; })
|
|
];
|
|
default = { };
|
|
};
|
|
};
|
|
}
|