From 219390d933334eb36dc42231ec28f0f2dbae9ef1 Mon Sep 17 00:00:00 2001 From: Julien Moutinho <julm@sourcephile.fr> Date: Wed, 11 Mar 2020 20:12:23 +0100 Subject: [PATCH] nix: remove networking.domainAliases --- nixos/modules/services/mail/dovecot.nix | 70 +------------------ nixos/modules/services/networking/domains.nix | 6 -- servers/mermet/nginx/sourcephile.fr/git.nix | 3 - 3 files changed, 3 insertions(+), 76 deletions(-) diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix index d33aa05..a4c693a 100644 --- a/nixos/modules/services/mail/dovecot.nix +++ b/nixos/modules/services/mail/dovecot.nix @@ -1,83 +1,19 @@ { pkgs, lib, config, ... }: let - inherit (builtins) toString toFile attrNames; - inherit (lib) types; - inherit (pkgs.lib) unlinesAttrs unlinesValues unwords; - inherit (config.services) dovecot2 openldap; - inherit (config) networking; + inherit (pkgs.lib) unlinesValues; + inherit (config.services) dovecot2; stateDir = "/var/lib/dovecot"; - escapeGroup = lib.stringAsChars (c: if "a"<=c && c<="z" - || "0"<=c && c<="9" - || c=="-" - then c else "_"); - domainGroup = escapeGroup "${networking.domainBase}"; in { -options.services.dovecot2 = { - domains = lib.mkOption { - default = {}; - type = types.attrsOf (types.submodule ({domain, ...}: { - #config.domain = lib.mkDefault domain; - options = { - accounts = lib.mkOption { - type = types.attrsOf (types.submodule ({account, ...}: { - options = { - password = lib.mkOption { - type = types.str; - example = "{SSHA512}uyjL1KYx4z7HpfNvnKzuVxpMLD2KVueGGBvOcj7AF1EZCTVhT++IIKUVOC4xpZtWdqVD0OVmZqgYr2qpn/3t3Aj4oU0="; - description = ''Password. - Use: `doveadm pw -s SSHA512 -p "$password"` - ''; - }; - aliases = lib.mkOption { - type = with types; listOf types.str; - example = [ "abuse@${config.networking.domain}" ]; - default = []; - description = ''Aliases of this account.''; - }; - quota = lib.mkOption { - type = with types; nullOr types.str; - default = null; - example = "2G"; - description = '' - Per user quota rules. Accepted sizes are `xx k/M/G/T` with the - obvious meaning. Leave blank for the standard quota `100G`. - ''; - }; - groups = lib.mkOption { - type = with types; listOf str; - default = []; - }; - }; - })); - }; - }; - })); - }; -}; - config = lib.mkIf dovecot2.enable { systemd.services.dovecot2 = { preStart = unlinesValues { - installDomains = - lib.optionalString openldap.enable '' - # NOTE: make sure nslcd cache is in sync with the LDAP data - systemctl restart nslcd - '' + '' + installDomains = '' # SEE: http://wiki2.dovecot.org/SharedMailboxes/Permissions install -D -d -m 0771 \ -o "${dovecot2.user}" \ -g "${dovecot2.group}" \ ${stateDir}/mail - - # NOTE: domainAliases point to the very same mailboxes as domain's. - for domainAlias in ${unwords networking.domainAliases} - do - ln -fns ${networking.domain} ${stateDir}/mail/$domainAlias - ln -fns ${networking.domain} ${stateDir}/control/$domainAlias - ln -fns ${networking.domain} ${stateDir}/index/$domainAlias - ln -fns ${networking.domain} ${stateDir}/acl/$domainAlias - done ''; }; }; diff --git a/nixos/modules/services/networking/domains.nix b/nixos/modules/services/networking/domains.nix index be3f6bf..a784c2d 100644 --- a/nixos/modules/services/networking/domains.nix +++ b/nixos/modules/services/networking/domains.nix @@ -7,11 +7,5 @@ options.networking = { description = "Base network name."; example = "example"; }; - domainAliases = lib.mkOption { - type = types.listOf types.str; - description = "Domain aliases."; - default = []; - example = [ "example.org" "example.net" ]; - }; }; } diff --git a/servers/mermet/nginx/sourcephile.fr/git.nix b/servers/mermet/nginx/sourcephile.fr/git.nix index 52eae4a..001e923 100644 --- a/servers/mermet/nginx/sourcephile.fr/git.nix +++ b/servers/mermet/nginx/sourcephile.fr/git.nix @@ -21,9 +21,6 @@ in services.nginx = { virtualHosts."git" = { serverName = "git.${domain}"; - serverAliases = - map (domainAlias: "git." + domainAlias) - config.networking.domainAliases; forceSSL = true; useACMEHost = domain; locations = { -- 2.47.2