2025-03-29 23:08:26 -05:00
|
|
|
{ lib, ... }:
|
|
|
|
let
|
|
|
|
stringType = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
intType = lib.mkOption {
|
|
|
|
type = lib.types.int;
|
|
|
|
};
|
|
|
|
listType = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
};
|
|
|
|
attrList = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf lib.types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
numOptions = 20;
|
|
|
|
|
|
|
|
genOptions =
|
|
|
|
config: prefix:
|
|
|
|
builtins.listToAttrs (
|
|
|
|
map (i: {
|
|
|
|
name = "${prefix}${toString i}";
|
|
|
|
value = config;
|
|
|
|
}) (builtins.genList (i: i) numOptions)
|
|
|
|
);
|
|
|
|
|
|
|
|
mkOptionsFromDir =
|
|
|
|
path:
|
|
|
|
builtins.listToAttrs (
|
|
|
|
map
|
|
|
|
(name: {
|
|
|
|
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
|
|
|
value = stringType;
|
|
|
|
})
|
|
|
|
(
|
|
|
|
builtins.filter (name: builtins.match ".*\\.nix$" name != null) (
|
|
|
|
builtins.attrNames (builtins.readDir path)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
userSubmodule = lib.types.submodule {
|
|
|
|
options = {
|
|
|
|
name = stringType;
|
|
|
|
label = stringType;
|
|
|
|
sshKeys = listType;
|
|
|
|
group = stringType;
|
|
|
|
aliases = genOptions stringType "name";
|
|
|
|
email = genOptions stringType "address";
|
|
|
|
paths = genOptions stringType "path";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
instanceSubmodule = lib.types.submodule {
|
|
|
|
options = {
|
|
|
|
subdomain = stringType;
|
|
|
|
label = stringType;
|
|
|
|
name = stringType;
|
2025-07-07 20:20:01 -05:00
|
|
|
short = stringType;
|
2025-03-29 23:08:26 -05:00
|
|
|
hostname = stringType;
|
2025-07-07 18:57:55 -05:00
|
|
|
tags = listType;
|
2025-03-29 23:08:26 -05:00
|
|
|
domains = genOptions stringType "url";
|
|
|
|
dns = genOptions stringType "provider";
|
|
|
|
localhost = genOptions stringType "address";
|
2025-07-01 04:11:32 -05:00
|
|
|
wireguard = genOptions stringType "interface";
|
2025-04-10 17:46:25 -05:00
|
|
|
remotehost = genOptions stringType "address";
|
2025-03-29 23:08:26 -05:00
|
|
|
email = genOptions stringType "address";
|
|
|
|
sops = genOptions stringType "path";
|
|
|
|
paths = genOptions stringType "path";
|
|
|
|
ports = genOptions intType "port";
|
|
|
|
ssl = {
|
|
|
|
cert = stringType;
|
|
|
|
key = stringType;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
deviceSubmodule = lib.types.submodule {
|
|
|
|
options =
|
|
|
|
let
|
|
|
|
mountConfig = {
|
|
|
|
mount = stringType;
|
|
|
|
device = stringType;
|
|
|
|
options = listType;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
boot = mountConfig;
|
|
|
|
ip = genOptions stringType "address";
|
|
|
|
label = stringType;
|
|
|
|
name = stringType;
|
|
|
|
sync = genOptions stringType "address";
|
2025-07-01 04:11:32 -05:00
|
|
|
wireguard = genOptions stringType "ip";
|
2025-03-29 23:08:26 -05:00
|
|
|
}
|
|
|
|
// genOptions mountConfig "folder"
|
|
|
|
// genOptions mountConfig "samba"
|
2025-06-25 18:28:16 -05:00
|
|
|
// genOptions mountConfig "remote"
|
2025-03-29 23:08:26 -05:00
|
|
|
// genOptions mountConfig "storage";
|
|
|
|
};
|
|
|
|
|
|
|
|
themesSubmodule = lib.types.submodule {
|
|
|
|
options = {
|
2025-06-26 02:15:04 -05:00
|
|
|
currentTheme = stringType;
|
2025-06-05 15:28:52 -05:00
|
|
|
windowManager = {
|
|
|
|
gaps = intType;
|
|
|
|
borders = intType;
|
|
|
|
rounding = intType;
|
|
|
|
};
|
2025-03-29 23:08:26 -05:00
|
|
|
fonts = {
|
2025-06-26 02:15:04 -05:00
|
|
|
name = stringType;
|
2025-03-29 23:08:26 -05:00
|
|
|
sizes = {
|
2025-06-26 02:15:04 -05:00
|
|
|
applications = intType;
|
|
|
|
desktop = intType;
|
|
|
|
popups = intType;
|
|
|
|
terminal = intType;
|
2025-03-29 23:08:26 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
cursor = {
|
|
|
|
name = stringType;
|
|
|
|
size = intType;
|
|
|
|
};
|
|
|
|
palettes = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf (
|
|
|
|
lib.types.submodule {
|
|
|
|
options = {
|
|
|
|
colours = attrList;
|
|
|
|
font = stringType;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options = mkOptionsFromDir ./instances/config // {
|
|
|
|
instances = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf instanceSubmodule;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
machines = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options =
|
|
|
|
let
|
|
|
|
devicesPath = ./devices/config;
|
|
|
|
printerPath = devicesPath + /printers;
|
|
|
|
in
|
|
|
|
mkOptionsFromDir devicesPath
|
|
|
|
// mkOptionsFromDir printerPath
|
|
|
|
// {
|
|
|
|
devices = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf deviceSubmodule;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
people = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options = mkOptionsFromDir ./users/config // {
|
|
|
|
users = lib.mkOption {
|
|
|
|
type = lib.types.attrsOf userSubmodule;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
aesthetics = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options = mkOptionsFromDir ./themes // {
|
|
|
|
themes = lib.mkOption {
|
|
|
|
type = themesSubmodule;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-06-26 21:20:09 -05:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
moduleFunctions = {
|
|
|
|
devicesFunctions = {
|
|
|
|
ownerWriteOthersReadMask = [
|
|
|
|
"fmask=0022"
|
|
|
|
"dmask=0022"
|
|
|
|
];
|
|
|
|
ownerExclusiveReadWriteMask = [
|
|
|
|
"fmask=0077"
|
|
|
|
"dmask=0077"
|
|
|
|
];
|
|
|
|
readWritePermissions = [
|
|
|
|
"rw"
|
|
|
|
];
|
|
|
|
sambaPermissions = [
|
|
|
|
"rw"
|
|
|
|
"gid=100"
|
|
|
|
"vers=3.0"
|
|
|
|
"x-systemd.automount"
|
|
|
|
"x-systemd.requires=network-online.target"
|
|
|
|
];
|
|
|
|
sshfsOptions = [
|
|
|
|
"allow_other"
|
|
|
|
"_netdev"
|
|
|
|
"x-systemd.automount"
|
|
|
|
"reconnect"
|
|
|
|
"user"
|
|
|
|
"ServerAliveInterval=15"
|
|
|
|
"IdentityFile=/var/run/secrets/ssh/private"
|
|
|
|
];
|
|
|
|
fileModeAndDirMode = [
|
|
|
|
"file_mode=0644"
|
|
|
|
"dir_mode=0755"
|
|
|
|
];
|
|
|
|
userIdForUser0 = [
|
|
|
|
"uid=1000"
|
|
|
|
];
|
|
|
|
userIdForUser1 = [
|
|
|
|
"uid=1002"
|
|
|
|
];
|
|
|
|
dummy = [
|
|
|
|
];
|
|
|
|
ceresStorageDriveName = "NAS1";
|
|
|
|
ceresIP = "192.168.50.140";
|
|
|
|
deimosIP = "192.168.50.142";
|
|
|
|
marsIP = "192.168.50.218";
|
|
|
|
phoneIP = "192.168.50.243";
|
|
|
|
phobosIP = "192.168.50.180";
|
|
|
|
synologyIP = "192.168.50.210";
|
|
|
|
brotherIP = "192.168.50.195";
|
|
|
|
externalIP = "24.76.173.0";
|
|
|
|
};
|
|
|
|
|
|
|
|
instancesFunctions = {
|
|
|
|
domain0 = "cloudbert.fun";
|
|
|
|
domain1 = "the-nutrivore.social";
|
|
|
|
domain2 = "the-nutrivore.com";
|
|
|
|
domain3 = "uprootnutrition.com";
|
|
|
|
servicePath = "/mnt/media/NAS1";
|
|
|
|
sopsPath = "/var/lib/secrets";
|
|
|
|
sslPath = "/var/lib/acme";
|
|
|
|
varLib = "/var/lib";
|
2025-07-07 18:57:55 -05:00
|
|
|
synologyName = "synology";
|
2025-06-26 21:20:09 -05:00
|
|
|
dummy = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
themesFunctions = {
|
|
|
|
brogrammer = "brogrammer";
|
|
|
|
catppuccin-frappe = "catppuccin-frappe";
|
|
|
|
catppuccin-latte = "catppuccin-latte";
|
|
|
|
catppuccin-macchiato = "catppuccin-macchiato";
|
|
|
|
catppuccin-mocha = "catppuccin-mocha";
|
|
|
|
chalk = "chalk";
|
|
|
|
deep-oceanic-next = "deep-oceanic-next";
|
|
|
|
dracula = "dracula";
|
|
|
|
espresso = "espresso";
|
|
|
|
flat = "flat";
|
|
|
|
framer = "framer";
|
|
|
|
github = "github";
|
|
|
|
hardcore = "hardcore";
|
|
|
|
one-black = "one-black";
|
|
|
|
one-dark = "one-dark";
|
|
|
|
one-light = "one light";
|
|
|
|
sparky = "sparky";
|
|
|
|
};
|
|
|
|
|
|
|
|
usersFunctions = {
|
|
|
|
user0 = "nick";
|
|
|
|
user0Label = "Nick";
|
|
|
|
user1 = "streaming";
|
|
|
|
user1Label = "Streaming";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
inheritFunctions = { inherit moduleFunctions; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
people = import ./users inheritFunctions;
|
|
|
|
services = import ./instances inheritFunctions;
|
|
|
|
machines = import ./devices inheritFunctions;
|
|
|
|
aesthetics = import ./themes inheritFunctions;
|
|
|
|
};
|
2025-03-29 23:08:26 -05:00
|
|
|
}
|