diff --git a/modules/shared/syscfg/server.nix b/modules/shared/syscfg/server.nix new file mode 100644 index 0000000..55f5968 --- /dev/null +++ b/modules/shared/syscfg/server.nix @@ -0,0 +1,92 @@ +{ lib,... }: +let + +in with lib; { + hostDomain = mkOption { type = types.str; }; + mailDomain = mkOption { type = types.str; }; + mailServer = mkOption { type = types.str; }; + + configPath = mkOption { + type = types.str; + default = "/media/config"; + }; + dataPath = mkOption { + type = types.str; + default = "/media/data"; + }; + + colorScheme = mkOption { + type = types.attrs; + default = (lib.evalModules { modules =[ { freeformType = with lib.types; attrsOf anything; } ../colors ];}).config.colorScheme ; + }; + loadedContainers = lib.mkOption { + readOnly = true; + type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: { + options = { + name = lib.mkOption {type = lib.types.str; default = name;}; + sops = lib.mkOption {type = lib.types.bool; default = false;}; + db = lib.mkOption {type = lib.types.bool; default = false;}; + + paths = lib.mkOption {type = lib.types.listOf lib.types.attrs; default = [ ];}; + containers = lib.mkOption {type = lib.types.attrsOf lib.types.attrs; default = { };}; + cron = lib.mkOption {type = lib.types.listOf lib.types.str; default = [ ];}; + + setup = { + trigger = lib.mkOption {type = lib.types.str; default = "";}; + script = lib.mkOption {type = lib.types.nullOr lib.types.package; default = null;}; + envFile = lib.mkOption {type = lib.types.nullOr lib.types.str; default = null;}; + }; + }; + })); + + }; + containers = mkOption { + type = types.attrsOf (types.submodule { + options = { + subdomain = mkOption { type = types.nullOr types.str; default=null;}; + subpath = mkOption { type = types.nullOr types.str; default=null;}; + port = mkOption { type = types.nullOr types.port; default = null; }; + extra = mkOption { type = types.attrs; default = {}; }; + }; + }); + default = {}; + }; + openssh = mkOption { + type = types.bool; + default = false; + }; + wireguard = mkOption { + type = types.bool; + default = false; + }; + web = mkOption { + type = types.bool; + default = false; + }; + ipfw = { + enable = mkOption { + type = types.bool; + default = false; + }; + ifs = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + ports = mkOption { + type = types.listOf (types.listOf (types.oneOf [ types.str types.int ])); + default = []; + description = "Forwarding rules: [ [srcInterface dstAddr srcPort dstPort] ... ]"; + example = [ + [ "ens3" "10.10.1.2" "IPV6" 22 2222 ] + [ "ens3" "10.10.1.2" "IPV6" 80 80 ] + [ "ens3" "10.10.1.2" "IPV6" 443 443 ] + ]; + }; + }; + + db = mkOption { + type = types.listOf (types.str); + default = [ ]; + }; + +} \ No newline at end of file