diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-30 14:05:39 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-30 14:05:39 +0200 |
| commit | c153a351659e4596acfc31f00bf594343cbfcd68 (patch) | |
| tree | a9ed83de07711d6424fbea09aad28891bae5bfe4 /modules/by-name/an/anubis/module.nix | |
| parent | hosts/server3: Setup prometheus server in agent mode (diff) | |
| download | nixos-server-c153a351659e4596acfc31f00bf594343cbfcd68.zip | |
modules: Use namespaces
That might make it easier in the future to merge different server
configs together (and thusly facilitate code-reuse.).
Diffstat (limited to 'modules/by-name/an/anubis/module.nix')
| -rw-r--r-- | modules/by-name/an/anubis/module.nix | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/modules/by-name/an/anubis/module.nix b/modules/by-name/an/anubis/module.nix deleted file mode 100644 index 4e70e4f..0000000 --- a/modules/by-name/an/anubis/module.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ - config, - lib, - ... -}: let - cfg = config.vhack.anubis; - - anubisInstances = - lib.mapAttrs (domain: conf: { - settings = { - TARGET = conf.target; - BIND = "/run/anubis/anubis-${domain}/anubis.sock"; - METRICS_BIND = "/run/anubis/anubis-${domain}/anubis-metrics.sock"; - }; - }) - cfg.instances; - - nginxVirtualHosts = lib.mapAttrs' (domain: conf: - lib.nameValuePair domain { - locations."/" = { - proxyPass = "http://unix:${config.services.anubis.instances."${domain}".settings.BIND}"; - - recommendedProxySettings = true; - proxyWebsockets = true; - }; - - enableACME = true; - forceSSL = true; - }) - cfg.instances; -in { - options.vhack.anubis.instances = lib.mkOption { - description = '' - Protect this reverse proxy with anubis. - - The attr key is the subdomain, the value the config. - ''; - - type = lib.types.attrsOf (lib.types.submodule { - options = { - target = lib.mkOption { - description = "nginx `proxyPass` target"; - type = lib.types.str; - example = "http://127.0.0.1:8080"; - }; - }; - config = {}; - }); - - default = {}; - - example = lib.literalExample '' - { - target = "http://127.0.0.1:$${toString config.servies.<name>.port}"; - } - ''; - }; - - config = { - users = { - users.nginx.extraGroups = [ - config.services.anubis.defaultOptions.group - ]; - - users.anubis = { - uid = config.vhack.constants.ids.uids.anubis; - group = "anubis"; - }; - groups.anubis.gid = config.vhack.constants.ids.gids.anubis; - }; - - vhack.nginx = lib.mkIf (cfg.instances != {}) { - enable = true; - }; - - services = { - anubis = { - defaultOptions.settings.COOKIE_DYNAMIC_DOMAIN = true; - instances = anubisInstances; - }; - - nginx = { - enable = true; - - recommendedTlsSettings = true; - recommendedOptimisation = true; - recommendedGzipSettings = true; - recommendedProxySettings = true; - - virtualHosts = nginxVirtualHosts; - }; - }; - }; -} |
