NixOS/modules/servers/base.nix

31 lines
722 B
Nix

{ lib, config, ... }:
let
mkOptions = name: subdomain: port: {
enable = lib.mkEnableOption "enable";
enableCron = lib.mkEnableOption "enable cronjob";
port = lib.mkOption {
type = lib.types.int;
default = port;
};
name = lib.mkOption {
type = lib.types.str;
default = name;
};
host = lib.mkOption {
type = lib.types.str;
default = "${subdomain}.${config.my.domain}";
};
url = lib.mkOption {
type = lib.types.str;
default = "https://${config.my.servers.${name}.host}";
};
local = lib.mkOption {
type = lib.types.str;
default = "http://${config.my.localhost}:${toString port}";
};
};
in
{
inherit mkOptions;
}