feat: Dynamic templating

This commit is contained in:
Inex Code
2024-12-18 15:40:15 +03:00
parent 7b69b39bff
commit cca51699ee
36 changed files with 802 additions and 43 deletions

View File

@@ -14,6 +14,27 @@
};
configPathsNeeded =
builtins.fromJSON (builtins.readFile ./config-paths-needed.json);
meta = { lib, ... }: {
spModuleVersion = 1;
id = "simple-nixos-mailserver";
name = "Mail Server";
description = "E-Mail for company and family.";
svgIcon = builtins.readFile ./icon.svg;
isMovable = true;
isRequired = true;
canBeBackedUp = true;
backupDescription = "Mail boxes and filters.";
systemdServices = [
"dovecot2.service"
"postfix.service"
];
user = "virtualMail";
folders = [
"/var/vmail"
"/var/sieve"
];
supportLevel = "normal";
};
# TODO generate json docs from module? something like:
# nix eval --impure --expr 'let flake = builtins.getFlake (builtins.toPath ./.); pkgs = flake.inputs.mailserver.inputs.nixpkgs.legacyPackages.x86_64-linux; in (pkgs.nixosOptionsDoc { inherit (pkgs.lib.evalModules { modules = [ flake.nixosModules.default ]; }) options; }).optionsJSON'

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.3333 2.66675H2.66665C1.93331 2.66675 1.33998 3.26675 1.33998 4.00008L1.33331 12.0001C1.33331 12.7334 1.93331 13.3334 2.66665 13.3334H13.3333C14.0666 13.3334 14.6666 12.7334 14.6666 12.0001V4.00008C14.6666 3.26675 14.0666 2.66675 13.3333 2.66675ZM13.3333 12.0001H2.66665V5.33341L7.99998 8.66675L13.3333 5.33341V12.0001ZM7.99998 7.33341L2.66665 4.00008H13.3333L7.99998 7.33341Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 508 B

View File

@@ -1,12 +1,22 @@
{ lib, ... }:
{
options.selfprivacy.modules.simple-nixos-mailserver = {
enable = lib.mkOption {
enable = (lib.mkOption {
default = false;
type = lib.types.bool;
description = "Enable mail server";
}) // {
meta = {
type = "enable";
};
};
location = lib.mkOption {
location = (lib.mkOption {
type = lib.types.str;
description = "Location";
}) // {
meta = {
type = "location";
};
};
};
}